Created
November 1, 2018 07:29
-
-
Save eusthace811/6616c7b8a1c621d8ab5b6768ccd3c746 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
/** | |
@notice Generate random number from sig | |
@param _sigseed Sign hash for creation random number | |
@param _min Minimal random number | |
@param _max Maximal random number | |
@return random number | |
*/ | |
function generateRnd(bytes _sigseed, uint _min, uint _max) public pure returns(uint) { | |
require(_max < 2**128); | |
return uint256(keccak256(_sigseed)) % (_max.sub(_min).add(1)).add(_min); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment