Skip to content

Instantly share code, notes, and snippets.

@michielmulders
Created May 24, 2018 08:49
Show Gist options
  • Save michielmulders/b14d795a1d2c38af1133ea546fc641bc to your computer and use it in GitHub Desktop.
Save michielmulders/b14d795a1d2c38af1133ea546fc641bc to your computer and use it in GitHub Desktop.
Simple random number generation Ethereum smart contract Solidity
function random() private view returns (uint8) {
return uint8(uint256(keccak256(block.timestamp, block.difficulty))%251);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment