Random (Java SE 24 & JDK 24)
- All Implemented Interfaces:
Serializable,RandomGenerator
- Direct Known Subclasses:
SecureRandom,ThreadLocalRandom
-
Nested Class Summary
-
Constructor Summary
Constructors
-
Method Summary
doubles()Returns 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).doubles(long streamSize) 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.ints()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).longs()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).protected intnext(int bits) Generates the next pseudorandom number.
booleanReturns the next pseudorandom, uniformly distributed
booleanvalue from this random number generator's sequence.voidnextBytes(byte[] bytes) Generates random bytes and places them into a user-supplied byte array.
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.intnextInt()Returns the next pseudorandom, uniformly distributed
intvalue from this random number generator's sequence.intnextInt(int bound) Returns a pseudorandom, uniformly distributed
intvalue between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.longnextLong()Returns the next pseudorandom, uniformly distributed
longvalue from this random number generator's sequence.voidsetSeed(long seed) Sets or updates the seed of this random number generator using the provided
longseed value (optional operation).Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods declared in interface java.util.random.RandomGenerator
equiDoubles, isDeprecated, nextDouble, nextDouble, nextExponential, nextFloat, nextFloat, nextGaussian, nextInt, nextLong, nextLong
-
Constructor Details
-
Random
-
Random
-
-
Method Details
-
from
-
setSeed
-
next
-
nextBytes
-
nextInt
-
nextInt
-
nextLong
-
nextBoolean
-
nextFloat
-
nextDouble
-
nextGaussian
-
ints
-
ints
-
ints
-
ints
-
longs
-
longs
-
longs
-
longs
-
doubles
-
doubles
-
doubles
-
doubles
-