Skip to content

Commit 47f5242

Browse files
author
Riccardo Persiani
committed
correct wrong range in some comments
1 parent 8e358b1 commit 47f5242

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

solidity/random-datasource/randomExample.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ contract RandomExample is usingOraclize {
3434
newRandomNumber_bytes(bytes(_result)); // this is the resulting random number (bytes)
3535

3636
// for simplicity of use, let's also convert the random bytes to uint if we need
37-
uint maxRange = 2**(8* 7); // this is the highest uint we want to get. It should never be greater than 2^(8*N), where N is the number of random bytes we had asked the datasource to return
38-
uint randomNumber = uint(sha3(_result)) % maxRange; // this is an efficient way to get the uint out in the [0, maxRange] range
37+
uint maxRange = 2**(8* 7); // [maxRange - 1] is the highest uint we want to get.The variable maxRange should never be greater than 2^(8*N), where N is the number of random bytes we had asked the datasource to return
38+
uint randomNumber = uint(sha3(_result)) % maxRange; // this is an efficient way to get the uint out in the [0, maxRange-1] range
3939

4040
newRandomNumber_uint(randomNumber); // this is the resulting random number (uint)
4141
}

0 commit comments

Comments
 (0)