Page 1 of 1

The following solidity code segment aim to select a winner at random from the a set of players (assume num_player is the

Posted: Mon Mar 21, 2022 4:46 pm
by answerhappygod
The following solidity code segment aim to select a winner at
random from the a set of players (assume num_player is the
number of players). Explain what is the vulnerability of this
method.
contract Game {
uint winner_ID;
uint num_player;
function guessing() external{
winner_ID = uint256(block.blockhash(block.number -
1)) % num_player;
}
}