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:
java.io.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.  
static void main(java.lang.String[] args)
          Deprecated.  
 boolean nextBoolean()
          Deprecated. override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm)
 void nextBytes(byte[] buf)
          Deprecated. override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm)
 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. override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm)
 int nextInt()
          Deprecated. override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm)
 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. override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm)
 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, 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. 
Description copied from class: RandomSource
override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm)

Overrides:
nextBytes in class RandomSource

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. 
Description copied from class: RandomSource
override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm)

Overrides:
nextInt in class RandomSource

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. 
Description copied from class: RandomSource
override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm)

Overrides:
nextLong in class RandomSource

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 RandomSource

nextDouble

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

Overrides:
nextDouble in class RandomSource

nextFloat

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

Overrides:
nextFloat in class RandomSource

nextGaussian

public double nextGaussian()
Deprecated. 
Description copied from class: RandomSource
override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm)

Overrides:
nextGaussian in class RandomSource

main

public static void main(java.lang.String[] args)
Deprecated.