SecureRandom (Java SE 26 & JDK 26)
- All Implemented Interfaces:
Serializable, RandomGenerator
-
Nested Class Summary
Nested classes/interfaces declared in interface RandomGenerator
RandomGenerator.ArbitrarilyJumpableGenerator, RandomGenerator.JumpableGenerator, RandomGenerator.LeapableGenerator, RandomGenerator.SplittableGenerator, RandomGenerator.StreamableGeneratorstatic interfaceThis interface is designed to provide a common protocol for objects that generate sequences of pseudorandom values and can easily jump forward, by an arbitrary amount, to a distant point in the state cycle.
static interfaceThis interface is designed to provide a common protocol for objects that generate pseudorandom values and can easily jump forward, by a moderate amount (ex. 264) to a distant point in the state cycle.
static interfaceThis interface is designed to provide a common protocol for objects that generate sequences of pseudorandom values and can easily not only jump but also leap forward, by a large amount (ex. 2128), to a very distant point in the state cycle.
static interfaceThis interface is designed to provide a common protocol for objects that generate sequences of pseudorandom values and can be split into two objects (the original one and a new one) each of which obey that same protocol (and therefore can be recursively split indefinitely).
static interface -
Constructor Summary
Constructors
Constructs a secure random number generator (RNG) implementing the default random number algorithm.
SecureRandom(byte[] seed) Constructs a secure random number generator (RNG) implementing the default random number algorithm.
protectedCreates a
SecureRandomobject. -
Method Summary
byte[]generateSeed(int numBytes) Returns the given number of seed bytes, computed using the seed generation algorithm that this class uses to seed itself.
Returns the name of the algorithm implemented by this
SecureRandomobject.Returns a
SecureRandomobject that implements the specified Random Number Generator (RNG) algorithm.Returns a
SecureRandomobject that implements the specified Random Number Generator (RNG) algorithm.Returns a
SecureRandomobject that implements the specified Random Number Generator (RNG) algorithm.Returns a
SecureRandomobject that implements the specified Random Number Generator (RNG) algorithm and supports the specifiedSecureRandomParametersrequest.Returns a
SecureRandomobject that implements the specified Random Number Generator (RNG) algorithm and supports the specifiedSecureRandomParametersrequest.Returns a
SecureRandomobject that implements the specified Random Number Generator (RNG) algorithm and supports the specifiedSecureRandomParametersrequest.Returns a
SecureRandomobject that was selected by using the algorithms/providers specified in thesecurerandom.strongAlgorithmsSecurityproperty.Returns the provider of this
SecureRandomobject.static byte[]getSeed(int numBytes) Returns the given number of seed bytes, computed using the seed generation algorithm that this class uses to seed itself.
protected final intnext(int numBits) Generates an integer containing the user-specified number of pseudo-random bits (right justified, with leading zeros).
voidnextBytes(byte[] bytes) Generates a user-specified number of random bytes.
voidGenerates a user-specified number of random bytes with additional parameters.
voidreseed()Reseeds this
SecureRandomwith entropy input read from its entropy source.voidReseeds this
SecureRandomwith entropy input read from its entropy source with additional parameters.voidsetSeed(byte[] seed) Reseeds this random object with the given seed.
voidsetSeed(long seed) Reseeds this random object, using the eight bytes contained in the given
long seed.toString()Returns a Human-readable string representation of this
SecureRandom.Methods declared in class Random
doubles, doubles, doubles, doubles, from, ints, ints, ints, ints, longs, longs, longs, longs, nextBoolean, nextDouble, nextFloat, nextGaussian, nextInt, nextInt, nextLongReturns an effectively unlimited stream of pseudorandom
doublevalues, each between zero (inclusive) and one (exclusive).doubles(double randomNumberOrigin, double randomNumberBound) Returns an effectively unlimited stream of pseudorandom
doublevalues, each conforming to the given origin (inclusive) and bound (exclusive).Returns a stream producing the given
streamSizenumber of pseudorandomdoublevalues, each between zero (inclusive) and one (exclusive).doubles(long streamSize, double randomNumberOrigin, double randomNumberBound) Returns a stream producing the given
streamSizenumber of pseudorandomdoublevalues, each conforming to the given origin (inclusive) and bound (exclusive).Returns an instance of
Randomthat delegates method calls to theRandomGeneratorargument.Returns an effectively unlimited stream of pseudorandom
intvalues.ints(int randomNumberOrigin, int randomNumberBound) Returns an effectively unlimited stream of pseudorandom
intvalues, each conforming to the given origin (inclusive) and bound (exclusive).ints(long streamSize) Returns a stream producing the given
streamSizenumber of pseudorandomintvalues.ints(long streamSize, int randomNumberOrigin, int randomNumberBound) Returns a stream producing the given
streamSizenumber of pseudorandomintvalues, each conforming to the given origin (inclusive) and bound (exclusive).Returns an effectively unlimited stream of pseudorandom
longvalues.longs(long streamSize) Returns a stream producing the given
streamSizenumber of pseudorandomlongvalues.longs(long randomNumberOrigin, long randomNumberBound) Returns an effectively unlimited stream of pseudorandom
longvalues, each conforming to the given origin (inclusive) and bound (exclusive).longs(long streamSize, long randomNumberOrigin, long randomNumberBound) Returns a stream producing the given
streamSizenumber of pseudorandomlong, each conforming to the given origin (inclusive) and bound (exclusive).booleanReturns the next pseudorandom, uniformly distributed
booleanvalue from this random number generator's sequence.doubleReturns the next pseudorandom, uniformly distributed
doublevalue between0.0and1.0from this random number generator's sequence.floatReturns the next pseudorandom, uniformly distributed
floatvalue between0.0and1.0from this random number generator's sequence.doubleReturns the next pseudorandom, Gaussian ("normally") distributed
doublevalue with mean0.0and standard deviation1.0from this random number generator's sequence.intReturns the next pseudorandom, uniformly distributed
intvalue from this random number generator's sequence.intReturns a pseudorandom, uniformly distributed
intvalue between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.longReturns the next pseudorandom, uniformly distributed
longvalue from this random number generator's sequence.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitCreates and returns a copy of this object.
booleanIndicates whether some other object is "equal to" this one.
protected voidDeprecated, for removal: This API element is subject to removal in a future version.
Returns the runtime class of this
Object.intReturns a hash code value for this object.
final voidWakes up a single thread that is waiting on this object's monitor.
final voidWakes up all threads that are waiting on this object's monitor.
final voidCauses the current thread to wait until it is awakened, typically by being notified or interrupted.
final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
Methods declared in interface RandomGenerator
equiDoubles, isDeprecated, nextDouble, nextDouble, nextExponential, nextFloat, nextFloat, nextGaussian, nextInt, nextLong, nextLongequiDoubles(double left, double right, boolean isLeftIncluded, boolean isRightIncluded) Returns an effectively unlimited stream of pseudorandomly chosen
doublevalues, where each value is between the specifiedleftboundary and the specifiedrightboundary.default booleanReturn true if the implementation of RandomGenerator (algorithm) has been marked for deprecation.
default doubleReturns a pseudorandomly chosen
doublevalue between zero (inclusive) and the specified bound (exclusive).default doubleReturns a pseudorandomly chosen
doublevalue between the specified origin (inclusive) and the specified bound (exclusive).default doubleReturns a nonnegative
doublevalue pseudorandomly chosen from an exponential distribution whose mean is 1.default floatReturns a pseudorandomly chosen
floatvalue between zero (inclusive) and the specified bound (exclusive).default floatReturns a pseudorandomly chosen
floatvalue between the specified origin (inclusive) and the specified bound (exclusive).default doubleReturns a
doublevalue pseudorandomly chosen from a Gaussian (normal) distribution with a mean and standard deviation specified by the arguments.default intnextInt(int origin, int bound) Returns a pseudorandomly chosen
intvalue between the specified origin (inclusive) and the specified bound (exclusive).default longReturns a pseudorandomly chosen
longvalue between zero (inclusive) and the specified bound (exclusive).default longnextLong(long origin, long bound) Returns a pseudorandomly chosen
longvalue between the specified origin (inclusive) and the specified bound (exclusive).
-
Constructor Details
-
SecureRandom
-
SecureRandom
-
SecureRandom
-
-
Method Details
-
getInstance
-
getInstance
-
getInstance
-
getInstance
-
getInstance
-
getInstance
-
getProvider
-
getAlgorithm
-
toString
-
getParameters
-
setSeed
-
setSeed
-
nextBytes
-
nextBytes
-
next
-
getSeed
-
generateSeed
-
getInstanceStrong
-
reseed
-
reseed
-