2006-04-14 jrandom

* -28.00230115311259 is not between 0 and 1 in any universe I know.
    * Made the bw-related tunnel join throttle much simpler
This commit is contained in:
jrandom
2006-04-14 18:04:11 +00:00
committed by zzz
parent 8d0a9b4ccd
commit 90cd7ff23a
5 changed files with 61 additions and 16 deletions

View File

@@ -157,11 +157,12 @@ public class FortunaRandomSource extends RandomSource implements EntropyHarveste
* through 2^numBits-1
*/
protected synchronized int nextBits(int numBits) {
int rv = 0;
long rv = 0;
int bytes = (numBits + 7) / 8;
for (int i = 0; i < bytes; i++)
rv += ((_fortuna.nextByte() & 0xFF) << i*8);
return rv;
rv >>>= (64-numBits);
return (int)rv;
}
public EntropyHarvester harvester() { return this; }