Created
February 2, 2023 10:46
-
-
Save bartubozkurt/dfccc47d059028c38bac9da360ccb77e 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
/* Bad */ | |
function getRandomNum() public view returns(uint256 randomNum_) { | |
randomNum_ = uint256(keccak256(block.blockhash(block.number - 1), now)) | |
} | |
/* Better */ | |
// Using VRF by Chainlink | |
// https://docs.chain.link/docs/vrf/v2/examples/get-a-random-number/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment