1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2024-11-22 08:08:11 +00:00

Merge pull request #536 from Quuxplusone/numeric-limits

Stop using numeric_limits for the constant "255", and fix a bug.
This commit is contained in:
Will Binns 2019-05-08 13:40:15 +00:00 committed by GitHub
commit 70ba34d079
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,7 +45,7 @@ bc::ec_secret random_secret(std::default_random_engine& engine)
bc::ec_secret secret;
// Iterate through every byte setting a random value...
for (uint8_t& byte: secret)
byte = engine() % std::numeric_limits<uint8_t>::max();
byte = engine() & 255;
// Return result.
return secret;
}