|
||||||||||
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
public class RandomSource
Singleton for whatever PRNG i2p uses.
Field Summary | |
---|---|
protected I2PAppContext |
_context
|
Constructor Summary | |
---|---|
RandomSource(I2PAppContext context)
|
Method Summary | |
---|---|
void |
feedEntropy(java.lang.String source,
byte[] data,
int offset,
int len)
Feed the entropy pools with data[offset:offset+len] |
void |
feedEntropy(java.lang.String source,
long data,
int bitoffset,
int bits)
Feed the entropy pools with the bits in the data |
static RandomSource |
getInstance()
|
EntropyHarvester |
harvester()
|
boolean |
initSeed(byte[] buf)
|
void |
loadSeed()
|
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()
override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm) |
float |
nextFloat()
override as synchronized, for those JVMs that don't always pull via nextBytes (cough ibm) |
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. |
void |
saveSeed()
|
static void |
writeSeed(byte[] buf)
|
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 |
Field Detail |
---|
protected I2PAppContext _context
Constructor Detail |
---|
public RandomSource(I2PAppContext context)
Method Detail |
---|
public static RandomSource getInstance()
public int nextInt(int n)
nextInt
in class java.util.Random
public long nextLong(long n)
public boolean nextBoolean()
nextBoolean
in class java.util.Random
public void nextBytes(byte[] buf)
nextBytes
in class java.security.SecureRandom
public double nextDouble()
nextDouble
in class java.util.Random
public float nextFloat()
nextFloat
in class java.util.Random
public double nextGaussian()
nextGaussian
in class java.util.Random
public int nextInt()
nextInt
in class java.util.Random
public long nextLong()
nextLong
in class java.util.Random
public EntropyHarvester harvester()
public void feedEntropy(java.lang.String source, long data, int bitoffset, int bits)
EntropyHarvester
feedEntropy
in interface EntropyHarvester
source
- origin of the entropy, allowing the harvester to
determine how much to value the databitoffset
- bit index into the data array to start
(using java standard big-endian)bits
- how many bits to usepublic void feedEntropy(java.lang.String source, byte[] data, int offset, int len)
EntropyHarvester
feedEntropy
in interface EntropyHarvester
source
- origin of the entropy, allowing the harvester to
determine how much to value the dataoffset
- index into the data array to startlen
- how many bytes to usepublic void loadSeed()
public void saveSeed()
public static final void writeSeed(byte[] buf)
public final boolean initSeed(byte[] buf)
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |