Skip to content

Instantly share code, notes, and snippets.

@DoguD
Created September 27, 2022 09:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DoguD/d3a1ec90acc58f076187d0eb10e35900 to your computer and use it in GitHub Desktop.
Save DoguD/d3a1ec90acc58f076187d0eb10e35900 to your computer and use it in GitHub Desktop.
// Source: https://blog.finxter.com/how-to-generate-random-numbers-in-solidity/
pragma solidity ^0.8.0;
contract RandomNumbers{
function createRandom(uint number) public view returns(uint){
return uint(blockhash(block.number-1)) % number;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment