Skip to content

Instantly share code, notes, and snippets.

@bartubozkurt
Created February 2, 2023 10:46
Show Gist options
  • Save bartubozkurt/dfccc47d059028c38bac9da360ccb77e to your computer and use it in GitHub Desktop.
Save bartubozkurt/dfccc47d059028c38bac9da360ccb77e to your computer and use it in GitHub Desktop.
/* 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