net.i2p.util
Class BufferedRandomSource

java.lang.Object
  extended by java.util.Random
      extended by java.security.SecureRandom
          extended by net.i2p.util.RandomSource
              extended by net.i2p.util.BufferedRandomSource
All Implemented Interfaces:
Serializable, EntropyHarvester

Deprecated. Unused! See FortunaRandomSource

public class BufferedRandomSource
extends RandomSource

Allocate data out of a large buffer of data, rather than the PRNG's (likely) small buffer to reduce the frequency of prng recalcs (though the recalcs are now more time consuming).

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.i2p.util.RandomSource
_context
 
Constructor Summary
BufferedRandomSource(I2PAppContext context)
          Deprecated.  
BufferedRandomSource(I2PAppContext context, int bufferSize)
          Deprecated.  
 
Method Summary
(package private) static int countBits(long val)
          Deprecated.  
 boolean nextBoolean()
          Deprecated. override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm)
 void nextBytes(byte[] buf)
          Deprecated.  
 double nextDouble()
          Deprecated. defined per javadoc ( ((nextBits(26)<<27) + nextBits(27)) / (1 << 53))
 float nextFloat()
          Deprecated. defined per javadoc (nextBits(24) / ((float)(1 << 24)) )
 double nextGaussian()
          Deprecated.  
 int nextInt()
          Deprecated.  
 int nextInt(int n)
          Deprecated. According to the java docs (http://java.sun.com/j2se/1.4.1/docs/api/java/util/Random.html#nextInt(int)) nextInt(n) should return a number between 0 and n (including 0 and excluding n).
 long nextLong()
          Deprecated.  
 long nextLong(long n)
          Deprecated. Like the modified nextInt, nextLong(n) returns a random number from 0 through n, including 0, excluding n.
 
Methods inherited from class net.i2p.util.RandomSource
feedEntropy, feedEntropy, getInstance, harvester, initSeed, loadSeed, main, saveSeed, writeSeed
 
Methods inherited from class java.security.SecureRandom
generateSeed, getAlgorithm, getInstance, getInstance, getInstance, getProvider, getSeed, next, setSeed, setSeed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferedRandomSource

public BufferedRandomSource(I2PAppContext context)
Deprecated. 

BufferedRandomSource

public BufferedRandomSource(I2PAppContext context,
                            int bufferSize)
Deprecated. 
Method Detail

nextBytes

public final void nextBytes(byte[] buf)
Deprecated. 
Overrides:
nextBytes in class SecureRandom

nextInt

public final int nextInt(int n)
Deprecated. 
Description copied from class: RandomSource
According to the java docs (http://java.sun.com/j2se/1.4.1/docs/api/java/util/Random.html#nextInt(int)) nextInt(n) should return a number between 0 and n (including 0 and excluding n). However, their pseudocode, as well as sun's, kaffe's, and classpath's implementation INCLUDES NEGATIVE VALUES. WTF. Ok, so we're going to have it return between 0 and n (including 0, excluding n), since thats what it has been used for.

Overrides:
nextInt in class RandomSource

nextInt

public final int nextInt()
Deprecated. 
Overrides:
nextInt in class Random

nextLong

public final long nextLong(long n)
Deprecated. 
Like the modified nextInt, nextLong(n) returns a random number from 0 through n, including 0, excluding n.

Overrides:
nextLong in class RandomSource

nextLong

public final long nextLong()
Deprecated. 
Overrides:
nextLong in class Random

countBits

static final int countBits(long val)
Deprecated. 

nextBoolean

public final boolean nextBoolean()
Deprecated. 
override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm)

Overrides:
nextBoolean in class Random

nextDouble

public final double nextDouble()
Deprecated. 
defined per javadoc ( ((nextBits(26)<<27) + nextBits(27)) / (1 << 53))

Overrides:
nextDouble in class Random

nextFloat

public float nextFloat()
Deprecated. 
defined per javadoc (nextBits(24) / ((float)(1 << 24)) )

Overrides:
nextFloat in class Random

nextGaussian

public double nextGaussian()
Deprecated. 
Overrides:
nextGaussian in class Random