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

  • Nested Class Summary

  • 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 java.lang.Object

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

  • 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