Created
September 27, 2022 09:01
-
-
Save DoguD/5428df6fd8cf42784138c21ec090b2e1 to your computer and use it in GitHub Desktop.
This file contains 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 random(uint number) public view returns(uint){ | |
return uint(keccak256(abi.encodePacked(block.timestamp,block.difficulty, | |
msg.sender))) % number; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment