forked from I2P_Developers/i2p.i2p
Random: Don't need extra bits if power of two
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user