Advertisement
Guest User

Untitled

a guest
Jun 21st, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. contract InsecureRandomGenerator {
  2. bytes32 public randseed;
  3.  
  4. function pseudoRandom(uint start, uint end)
  5. returns (uint) {
  6. randseed = keccak256(randseed, block.timestamp,
  7. block.blockhash(block.number-1), block.coinbase,
  8. block.difficulty, block.number);
  9. uint range = end - start + 1;
  10. uint randVal = start + uint256(randseed) % range;
  11. return randVal;
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement