Created
March 9, 2018 00:23
-
-
Save austintgriffith/b3ce938961f821b8194094dba7562bc5 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
| function getRandom(uint8 maxRan, uint8 index, address priAddress) constant public returns(uint8) { | |
| uint256 genNum = uint256(block.blockhash(block.number-1)) + uint256(priAddress); | |
| for (uint8 i = 0; i < index && i < 6; i ++) { | |
| genNum /= 256; | |
| } | |
| return uint8(genNum % maxRan); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment