Created
September 27, 2022 09:18
-
-
Save DoguD/d3a1ec90acc58f076187d0eb10e35900 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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