Constructor and Description |
---|
SecureRandom(RandomInterface random)
ctor.
|
Modifier and Type | Method and Description |
---|---|
void |
clean()
clean all important content.
|
byte[] |
generateSeed(int length)
Returns the given number of seed bytes.
|
java.lang.String |
getAlgorithm()
get algorithm name
|
static SecureRandom |
getInstance(java.lang.String algorithm)
Algorithm factory, create object by algorithm name.
|
static SecureRandom |
getInstance(java.lang.String algorithm,
java.security.Provider provider)
Algorithm factory, create object by algorithm name.
|
static SecureRandom |
getInstance(java.lang.String algorithm,
java.lang.String provider)
Algorithm factory, create object by algorithm name.
|
java.security.Provider |
getProvider()
Returns the provider of this object.
|
byte[] |
getSeed(int length)
Returns the given number of seed bytes.
|
boolean |
nextBoolean()
get next random boolean.
|
void |
nextBytes(byte[] bytes)
Get random bytes
Method from java.util.Random
|
void |
nextBytes(byte[] bytes,
int offset,
int length)
Get random bytes
Method from java.util.Random
|
double |
nextDouble()
get next random double.
|
float |
nextFloat()
get next random float.
|
double |
nextGaussian()
Returns the next random, Gaussian ("normally") distributed
double value with mean 0.0 and standard
deviation 1.0 from this random number generator's sequence. |
int |
nextInt()
get next random integer.
|
int |
nextInt(int mod)
Returns a random, uniformly distributed
int value
between 0 (inclusive) and the specified value (exclusive)
Method from java.util.Random |
long |
nextLong()
get next random long.
|
void |
setSeed(byte[] seed)
Reseeds this random object.
|
void |
setSeed(long seed)
Reseeds this random object.
|
java.lang.String |
toString() |
public SecureRandom(RandomInterface random)
random
- RandomInterface implementationpublic static SecureRandom getInstance(java.lang.String algorithm) throws java.security.NoSuchAlgorithmException
SecureRandom.getInstance(String)
.algorithm
- algorithm name.java.security.NoSuchAlgorithmException
- unknown algorithmpublic static SecureRandom getInstance(java.lang.String algorithm, java.lang.String provider) throws java.security.NoSuchAlgorithmException
SecureRandom.getInstance(String)
.algorithm
- algorithm name.provider
- unusedjava.security.NoSuchAlgorithmException
- unknown algorithmpublic static SecureRandom getInstance(java.lang.String algorithm, java.security.Provider provider) throws java.security.NoSuchAlgorithmException
SecureRandom.getInstance(String)
.algorithm
- algorithm name.provider
- unusedjava.security.NoSuchAlgorithmException
- unknown algorithmpublic java.lang.String getAlgorithm()
public java.security.Provider getProvider()
public void nextBytes(byte[] bytes)
bytes
- allocated bytes to be filled in with random bytes.public void nextBytes(byte[] bytes, int offset, int length)
bytes
- allocated bytes to be filled in with random bytes.offset
- offset in byteslength
- length to be filled with random bytespublic int nextInt()
public int nextInt(int mod)
int
value
between 0 (inclusive) and the specified value (exclusive)
Method from java.util.Randommod
- the bound on the random number to be returned. Must be positive.int
value between 0
(inclusive) and n
(exclusive)
from this random number generator's sequencejava.lang.IllegalArgumentException
- if n is not positive.public long nextLong()
public boolean nextBoolean()
public float nextFloat()
0.0
and 1.0
public double nextDouble()
0.0
and 1.0
public double nextGaussian()
double
value with mean 0.0
and standard
deviation 1.0
from this random number generator's sequence.
Method from java.util.Randompublic void setSeed(byte[] seed)
seed
- the seed.public void setSeed(long seed)
seed
- the seed.public byte[] getSeed(int length)
length
- the number of seed bytes to generate.public byte[] generateSeed(int length)
length
- the number of seed bytes to generate.public java.lang.String toString()
toString
in class java.lang.Object