Skip to content

Instantly share code, notes, and snippets.

@yhuag
Created December 2, 2018 16:35
Show Gist options
  • Save yhuag/982f0ee9196dd7a178a720b85ac9498a to your computer and use it in GitHub Desktop.
Save yhuag/982f0ee9196dd7a178a720b85ac9498a to your computer and use it in GitHub Desktop.
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