I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 6ef61063 authored by zzz's avatar zzz
Browse files

Random: Don't need extra bits if power of two

parent 23ee40d9
No related branches found
No related tags found
No related merge requests found
......@@ -108,12 +108,13 @@ public class FortunaRandomSource extends RandomSource implements EntropyHarveste
// get at least 4 extra bits if possible for better
// distribution after the %
// No extra needed if power of two.
int numBits;
if (n > 0xfffff)
if (n > 0x100000)
numBits = 31;
else if (n > 0xfff)
else if (n > 0x1000)
numBits = 24;
else if (n > 0xf)
else if (n > 0x10)
numBits = 16;
else
numBits = 8;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment