function createRandomNumber(uint maxnum) payable returns (uint256) {
        uint cnt;
        for (cnt = 0; cnt < lastRandom % 5; cnt++){lastBlock = lastBlock - block.timestamp;} 
        uint256 random = 
                  block.difficulty + block.gaslimit + 
                  block.timestamp + msg.gas + 
                  msg.value + tx.gasprice + 
                  seed1 + seed2 + seed3 + seed4 + seed5;
        random = random + uint256(block.blockhash(block.number - (lastRandom+1))[cnt]) +
                  (gamesPlayed*1234567890) * lastBlock + customSeed;
        random = random + uint256(lastPlayer) +  uint256(sha3(msg.sender)[cnt]);
        lastBlock = block.number;
        seed5 = seed4; seed4 = seed3; seed3 = seed2;
        seed2 = seed1; seed1 = (random / 43) + lastRandom; 
        bytes32 randomsha = sha3(random);
        lastRandom = (uint256(randomsha[cnt]) * maxnum) / 256;
        
        return lastRandom ;
        
    }