Created
December 2, 2018 16:35
-
-
Save yhuag/982f0ee9196dd7a178a720b85ac9498a to your computer and use it in GitHub Desktop.
This file contains 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
pragma solidity ^0.4.24; | |
contract FinalDecision { | |
mapping (uint => bool) alreadyDrawed; | |
uint public drawed; | |
uint[] public teams; | |
function rand() public{ | |
uint _team = uint(keccak256(now)) % 7 + 1; | |
uint flag = 0; | |
while(alreadyDrawed[_team]){ | |
flag++; | |
_team = uint(keccak256(now+flag)) % 7 + 1; | |
} | |
alreadyDrawed[_team] = true; | |
drawed++; | |
teams.push(_team); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment