|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Random
java.security.SecureRandom
net.i2p.util.RandomSource
net.i2p.util.BufferedRandomSource
public class BufferedRandomSource
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).
Field Summary |
---|
Fields inherited from class net.i2p.util.RandomSource |
---|
_context |
Constructor Summary | |
---|---|
BufferedRandomSource(I2PAppContext context)
|
|
BufferedRandomSource(I2PAppContext context,
int bufferSize)
|
Method Summary | |
---|---|
(package private) static int |
countBits(long val)
|
static void |
main(java.lang.String[] args)
|
boolean |
nextBoolean()
override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm) |
void |
nextBytes(byte[] buf)
override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm) |
double |
nextDouble()
defined per javadoc ( ((nextBits(26)<<27) + nextBits(27)) / (1 << 53)) |
float |
nextFloat()
defined per javadoc (nextBits(24) / ((float)(1 << 24)) ) |
double |
nextGaussian()
override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm) |
int |
nextInt()
override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm) |
int |
nextInt(int n)
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()
override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm) |
long |
nextLong(long n)
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 |
---|
public BufferedRandomSource(I2PAppContext context)
public BufferedRandomSource(I2PAppContext context, int bufferSize)
Method Detail |
---|
public final void nextBytes(byte[] buf)
RandomSource
nextBytes
in class RandomSource
public final int nextInt(int n)
RandomSource
nextInt
in class RandomSource
public final int nextInt()
RandomSource
nextInt
in class RandomSource
public final long nextLong(long n)
nextLong
in class RandomSource
public final long nextLong()
RandomSource
nextLong
in class RandomSource
static final int countBits(long val)
public final boolean nextBoolean()
nextBoolean
in class RandomSource
public final double nextDouble()
nextDouble
in class RandomSource
public float nextFloat()
nextFloat
in class RandomSource
public double nextGaussian()
RandomSource
nextGaussian
in class RandomSource
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |