2006-04-14 jrandom

* 0 isn't very random
    * Adjust the tunnel drop to be more reasonable
This commit is contained in:
jrandom
2006-04-14 20:24:07 +00:00
committed by zzz
parent 90cd7ff23a
commit de83944486
4 changed files with 14 additions and 6 deletions

View File

@ -161,7 +161,11 @@ public class FortunaRandomSource extends RandomSource implements EntropyHarveste
int bytes = (numBits + 7) / 8;
for (int i = 0; i < bytes; i++)
rv += ((_fortuna.nextByte() & 0xFF) << i*8);
rv >>>= (64-numBits);
//rv >>>= (64-numBits);
if (rv < 0)
rv = 0 - rv;
int off = 8*bytes - numBits;
rv >>>= off;
return (int)rv;
}