All Implemented Interfaces:
Serializable, RandomGenerator
Direct Known Subclasses:
SecureRandom, ThreadLocalRandom

  • Nested Class Summary

    Nested classes/interfaces declared in interface RandomGenerator

    RandomGenerator.ArbitrarilyJumpableGenerator, RandomGenerator.JumpableGenerator, RandomGenerator.LeapableGenerator, RandomGenerator.SplittableGenerator, RandomGenerator.StreamableGenerator

    static interface 

    This 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 interface 

    This 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 interface 

    This 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 interface 

    This 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

    Random()

    Creates a new random number generator.

    Random(long seed)

    Creates a new random number generator using a single long seed.

  • Method Summary

    doubles()

    Returns an effectively unlimited stream of pseudorandom double values, each between zero (inclusive) and one (exclusive).

    doubles(double randomNumberOrigin, double randomNumberBound)

    Returns an effectively unlimited stream of pseudorandom double values, each conforming to the given origin (inclusive) and bound (exclusive).

    doubles(long streamSize)

    Returns a stream producing the given streamSize number of pseudorandom double values, each between zero (inclusive) and one (exclusive).

    doubles(long streamSize, double randomNumberOrigin, double randomNumberBound)

    Returns a stream producing the given streamSize number of pseudorandom double values, each conforming to the given origin (inclusive) and bound (exclusive).

    Returns an instance of Random that delegates method calls to the RandomGenerator argument.

    ints()

    Returns an effectively unlimited stream of pseudorandom int values.

    ints(int randomNumberOrigin, int randomNumberBound)

    Returns an effectively unlimited stream of pseudorandom int values, each conforming to the given origin (inclusive) and bound (exclusive).

    ints(long streamSize)

    Returns a stream producing the given streamSize number of pseudorandom int values.

    ints(long streamSize, int randomNumberOrigin, int randomNumberBound)

    Returns a stream producing the given streamSize number of pseudorandom int values, each conforming to the given origin (inclusive) and bound (exclusive).

    longs()

    Returns an effectively unlimited stream of pseudorandom long values.

    longs(long streamSize)

    Returns a stream producing the given streamSize number of pseudorandom long values.

    longs(long randomNumberOrigin, long randomNumberBound)

    Returns an effectively unlimited stream of pseudorandom long values, each conforming to the given origin (inclusive) and bound (exclusive).

    longs(long streamSize, long randomNumberOrigin, long randomNumberBound)

    Returns a stream producing the given streamSize number of pseudorandom long, each conforming to the given origin (inclusive) and bound (exclusive).

    protected int

    next(int bits)

    Generates the next pseudorandom number.

    boolean

    Returns the next pseudorandom, uniformly distributed boolean value from this random number generator's sequence.

    void

    nextBytes(byte[] bytes)

    Generates random bytes and places them into a user-supplied byte array.

    double

    Returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.

    float

    nextFloat()

    Returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from this random number generator's sequence.

    double

    Returns the next pseudorandom, Gaussian ("normally") distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence.

    int

    nextInt()

    Returns the next pseudorandom, uniformly distributed int value from this random number generator's sequence.

    int

    nextInt(int bound)

    Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from this random number generator's sequence.

    long

    nextLong()

    Returns the next pseudorandom, uniformly distributed long value from this random number generator's sequence.

    void

    setSeed(long seed)

    Sets or updates the seed of this random number generator using the provided long seed value (optional operation).

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Creates and returns a copy of this object.

    boolean

    Indicates whether some other object is "equal to" this one.

    protected void

    Deprecated, for removal: This API element is subject to removal in a future version.

    Returns the runtime class of this Object.

    int

    Returns a hash code value for this object.

    final void

    Wakes up a single thread that is waiting on this object's monitor.

    final void

    Wakes up all threads that are waiting on this object's monitor.

    Returns a string representation of the object.

    final void

    Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

    final void

    wait(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 void

    wait(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, nextLong

    equiDoubles(double left, double right, boolean isLeftIncluded, boolean isRightIncluded)

    Returns an effectively unlimited stream of pseudorandomly chosen double values, where each value is between the specified left boundary and the specified right boundary.

    default boolean

    Return true if the implementation of RandomGenerator (algorithm) has been marked for deprecation.

    default double

    Returns a pseudorandomly chosen double value between zero (inclusive) and the specified bound (exclusive).

    default double

    Returns a pseudorandomly chosen double value between the specified origin (inclusive) and the specified bound (exclusive).

    default double

    Returns a nonnegative double value pseudorandomly chosen from an exponential distribution whose mean is 1.

    default float

    Returns a pseudorandomly chosen float value between zero (inclusive) and the specified bound (exclusive).

    default float

    Returns a pseudorandomly chosen float value between the specified origin (inclusive) and the specified bound (exclusive).

    default double

    Returns a double value pseudorandomly chosen from a Gaussian (normal) distribution with a mean and standard deviation specified by the arguments.

    default int

    nextInt(int origin, int bound)

    Returns a pseudorandomly chosen int value between the specified origin (inclusive) and the specified bound (exclusive).

    default long

    Returns a pseudorandomly chosen long value between zero (inclusive) and the specified bound (exclusive).

    default long

    nextLong(long origin, long bound)

    Returns a pseudorandomly chosen long value between the specified origin (inclusive) and the specified bound (exclusive).

  • 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