|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Random
java.security.SecureRandom
public class SecureRandom
| Constructor Summary | |
|---|---|
|
SecureRandom()
Constructs a new instance of this class. |
|
SecureRandom(byte[] seed)
Constructs a new instance of this class. |
protected |
SecureRandom(SecureRandomSpi secureRandomSpi,
Provider provider)
|
| Method Summary | |
|---|---|
byte[] |
generateSeed(int numBytes)
Generates a certain number of seed bytes |
String |
getAlgorithm()
|
static SecureRandom |
getInstance(String algorithm)
|
static SecureRandom |
getInstance(String algorithm,
Provider provider)
|
static SecureRandom |
getInstance(String algorithm,
String provider)
Returns a new SecureRandom which is capable of running the algorithm described by the argument. |
Provider |
getProvider()
Returns the Provider of the secure random represented by the receiver. |
static byte[] |
getSeed(int numBytes)
Returns the given number of seed bytes, computed using the seed generation algorithm used by this class. |
protected int |
next(int numBits)
Returns a pseudo-random uniformly distributed int value of
the number of bits specified by the argument bits as
described by Donald E. |
void |
nextBytes(byte[] bytes)
Modifies the byte array by a random sequence of bytes generated by this random number generator. |
void |
setSeed(byte[] seed)
|
void |
setSeed(long seed)
Reseeds this random object with the eight bytes described by the representation of the long provided. |
| Methods inherited from class java.util.Random |
|---|
nextBoolean, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLong |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SecureRandom()
getInstance() instead.
An implementation for the highest-priority provider is returned. The
instance returned will not have been seeded.
public SecureRandom(byte[] seed)
getInstance() instead.
An implementation for the highest-priority provider is returned. The
instance returned will be seeded with the parameter.
seed - bytes forming the seed for this generator.
protected SecureRandom(SecureRandomSpi secureRandomSpi,
Provider provider)
| Method Detail |
|---|
public static SecureRandom getInstance(String algorithm)
throws NoSuchAlgorithmException
NoSuchAlgorithmException
public static SecureRandom getInstance(String algorithm,
String provider)
throws NoSuchAlgorithmException,
NoSuchProviderException
algorithm - java.lang.String Name of the algorithm desiredprovider - java.security.Provider Provider which has to implement the
algorithm
NoSuchAlgorithmException - If the algorithm cannot be found
NoSuchProviderException
public static SecureRandom getInstance(String algorithm,
Provider provider)
throws NoSuchAlgorithmException
NoSuchAlgorithmExceptionpublic final Provider getProvider()
public String getAlgorithm()
public void setSeed(byte[] seed)
public void setSeed(long seed)
setSeed in class Randomseed - long Number whose representation to use to reseed the
receiver.Random.next(int),
Random.Random(),
Random.Random(long)public void nextBytes(byte[] bytes)
Random
nextBytes in class Randombytes - non-null array to contain the new random bytesRandom.next(int)protected final int next(int numBits)
Randomint value of
the number of bits specified by the argument bits as
described by Donald E. Knuth in The Art of Computer Programming,
Volume 2: Seminumerical Algorithms, section 3.2.1.
next in class RandomnumBits - number of bits of the returned value
Random.nextBytes(byte[]),
Random.nextDouble(),
Random.nextFloat(),
Random.nextInt(),
Random.nextInt(int),
Random.nextGaussian(),
Random.nextLong()public static byte[] getSeed(int numBytes)
numBytes - int the given number of seed bytes
public byte[] generateSeed(int numBytes)
numBytes - int Number of seed bytes to generate
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||