Package Summary  Overview Summary

class:SplittableRandom [CHANGED]

All Implemented Interfaces:
RandomGenerator, RandomGenerator.SplittableGenerator, RandomGenerator.StreamableGenerator

public final class SplittableRandomextends Object
A generator of uniform pseudorandom values (with period 264) applicable for use in (among other contexts) isolated parallel computations that may generate subtasks. Class SplittableRandom supports methods for producing pseudorandom numbers of type int, long, and double with similar usages as for class Random but differs in the following ways:
  • Series of generated values pass the DieHarder suite testing independence and uniformity properties of random number generators. (Most recently validated with version 3.31.1 .) These tests validate only the methods for certain types and ranges, but similar properties are expected to hold, at least approximately, for others as well. The period (length of any series of generated values before it repeats) is at least 264.
  • Method split() constructs and returns a new SplittableRandom instance that shares no mutable state with the current instance. However, with very high probability, the values collectively generated by the two objects have the same statistical properties as if the same quantity of values were generated by a single thread using a single SplittableRandom object.
  • Instances of SplittableRandom are not thread-safe. They are designed to be split, not shared, across threads. For example, a fork/join-style computation using random numbers might include a construction of the form new Subtask(aSplittableRandom.split()).fork() .
  • This class provides additional methods for generating random streams, that employ the above techniques when used in stream.parallel() mode.

Instances of SplittableRandom are not cryptographically secure. Consider instead using SecureRandom in security-sensitive applications. Additionally, default-constructed instances do not use a cryptographically random seed unless the system property java.util.secureRandomSeed is set to true.

Since:
1.8

                                                                    public final class SplittableRandom
extends Object
                        
                                    
A generator of uniform pseudorandom values applicable for use in (among other contexts) isolated parallel computations that may generate subtasks. Class SplittableRandom supports methods for producing pseudorandom numbers of type int, long, and double with similar usages as for class Random but differs in the following ways:
  • Series of generated values pass the DieHarder suite testing independence and uniformity properties of random number generators. (Most recently validated with version 3.31.1 .) These tests validate only the methods for certain types and ranges, but similar properties are expected to hold, at least approximately, for others as well. The period (length of any series of generated values before it repeats) is at least 264.
  • Method split() constructs and returns a new SplittableRandom instance that shares no mutable state with the current instance. However, with very high probability, the values collectively generated by the two objects have the same statistical properties as if the same quantity of values were generated by a single thread using a single SplittableRandom object.
  • Instances of SplittableRandom are not thread-safe. They are designed to be split, not shared, across threads. For example, a fork/join-style computation using random numbers might include a construction of the form new Subtask(aSplittableRandom.split()).fork() .
  • This class provides additional methods for generating random streams, that employ the above techniques when used in stream.parallel() mode.

Instances of SplittableRandom are not cryptographically secure. Consider instead using SecureRandom in security-sensitive applications. Additionally, default-constructed instances do not use a cryptographically random seed unless the system property java.util.secureRandomSeed is set to true.

Since:
1.8
All Implemented Interfaces:
RandomGenerator, RandomGenerator.SplittableGenerator, RandomGenerator.StreamableGenerator

public final class SplittableRandomextends Object
A generator of uniform pseudorandom values (with period 264) applicable for use in (among other contexts) isolated parallel computations that may generate subtasks. Class SplittableRandom supports methods for producing pseudorandom numbers of type int, long, and double with similar usages as for class Random but differs in the following ways:
  • Series of generated values pass the DieHarder suite testing independence and uniformity properties of random number generators. (Most recently validated with version 3.31.1 .) These tests validate only the methods for certain types and ranges, but similar properties are expected to hold, at least approximately, for others as well. The period (length of any series of generated values before it repeats) is at least 264.
  • Method split() constructs and returns a new SplittableRandom instance that shares no mutable state with the current instance. However, with very high probability, the values collectively generated by the two objects have the same statistical properties as if the same quantity of values were generated by a single thread using a single SplittableRandom object.
  • Instances of SplittableRandom are not thread-safe. They are designed to be split, not shared, across threads. For example, a fork/join-style computation using random numbers might include a construction of the form new Subtask(aSplittableRandom.split()).fork() .
  • This class provides additional methods for generating random streams, that employ the above techniques when used in stream.parallel() mode.

Instances of SplittableRandom are not cryptographically secure. Consider instead using SecureRandom in security-sensitive applications. Additionally, default-constructed instances do not use a cryptographically random seed unless the system property java.util.secureRandomSeed is set to true.

Since:
1.8

constructor:SplittableRandom(long) [NONE]

  • SplittableRandom

    public SplittableRandom(long seed)
    Creates a new SplittableRandom instance using the specified initial seed. SplittableRandom instances created with the same seed in the same program generate identical sequences of values.
    Parameters:
    seed - the initial seed
  • constructor:SplittableRandom() [NONE]

    SplittableRandom

    public SplittableRandom()
    Creates a new SplittableRandom instance that is likely to generate sequences of values that are statistically independent of those of any other instances in the current program; and may, and typically does, vary across program invocations.

    method:split() [CHANGED]

  • split

    public SplittableRandom split()
    Constructs and returns a new SplittableRandom instance that shares no mutable state with this instance. However, with very high probability, the set of values collectively generated by the two objects has the same statistical properties as if the same quantity of values were generated by a single thread using a single SplittableRandom object. Either or both of the two objects may be further split using the split() method, and the same expected statistical properties apply to the entire set of generators constructed by such recursive splitting.
    Specified by:
    split in interface RandomGenerator.SplittableGenerator
    Returns:
    the new SplittableRandom instance
  • split

    public SplittableRandom split()
    Constructs and returns a new SplittableRandom instance that shares no mutable state with this instance. However, with very high probability, the set of values collectively generated by the two objects has the same statistical properties as if the same quantity of values were generated by a single thread using a single SplittableRandom object. Either or both of the two objects may be further split using the split() method, and the same expected statistical properties apply to the entire set of generators constructed by such recursive splitting.
    Returns:
    the new SplittableRandom instance
  • split

    public SplittableRandom split()
    Constructs and returns a new SplittableRandom instance that shares no mutable state with this instance. However, with very high probability, the set of values collectively generated by the two objects has the same statistical properties as if the same quantity of values were generated by a single thread using a single SplittableRandom object. Either or both of the two objects may be further split using the split() method, and the same expected statistical properties apply to the entire set of generators constructed by such recursive splitting.
    Specified by:
    split in interface RandomGenerator.SplittableGenerator
    Returns:
    the new SplittableRandom instance
  • method:nextBytes(byte[]) [REMOVED]

    nextBytes

    public void nextBytes(byte[] bytes)
    Fills a user-supplied byte array with generated pseudorandom bytes.
    Parameters:
    bytes - the byte array to fill with pseudorandom bytes
    Throws:
    NullPointerException - if bytes is null
    Since:
    10

    method:nextInt() [REMOVED]

    nextInt

    public int nextInt()
    Returns a pseudorandom int value.
    Returns:
    a pseudorandom int value

    method:nextInt(int) [REMOVED]

    nextInt

    public int nextInt(int bound)
    Returns a pseudorandom int value between zero (inclusive) and the specified bound (exclusive).
    Parameters:
    bound - the upper bound (exclusive). Must be positive.
    Returns:
    a pseudorandom int value between zero (inclusive) and the bound (exclusive)
    Throws:
    IllegalArgumentException - if bound is not positive

    method:nextInt(int,int) [REMOVED]

    nextInt

    public int nextInt(int origin, int bound)
    Returns a pseudorandom int value between the specified origin (inclusive) and the specified bound (exclusive).
    Parameters:
    origin - the least value returned
    bound - the upper bound (exclusive)
    Returns:
    a pseudorandom int value between the origin (inclusive) and the bound (exclusive)
    Throws:
    IllegalArgumentException - if origin is greater than or equal to bound

    method:split(java.util.random.RandomGenerator.SplittableGenerator) [ADDED]

    split

    Description copied from interface: RandomGenerator.SplittableGenerator
    Returns a new pseudorandom number generator, split off from this one, that implements the RandomGenerator and RandomGenerator.SplittableGenerator interfaces.
    Parameters:
    source - a RandomGenerator.SplittableGenerator instance to be used instead of this one as a source of pseudorandom bits used to initialize the state of the new ones.
    Returns:
    an object that implements the RandomGenerator and RandomGenerator.SplittableGenerator interfaces

    method:nextLong() [CHANGED]

    nextLong

    public long nextLong()
    Description copied from interface: RandomGenerator
    Returns a pseudorandom(pseudo)randomly chosen long value.
    Returns:
    a pseudorandom(pseudo)randomly chosen long value

    nextLong

    public long nextLong()
    Returns a pseudorandom long value.
    Returns:
    a pseudorandom long value

    nextLong

    public long nextLong()
    Description copied from interface: RandomGenerator
    Returns a (pseudo)randomly chosen long value.
    Returns:
    a (pseudo)randomly chosen long value

    method:nextLong(long) [REMOVED]

    nextLong

    public long nextLong(long bound)
    Returns a pseudorandom long value between zero (inclusive) and the specified bound (exclusive).
    Parameters:
    bound - the upper bound (exclusive). Must be positive.
    Returns:
    a pseudorandom long value between zero (inclusive) and the bound (exclusive)
    Throws:
    IllegalArgumentException - if bound is not positive

    method:nextLong(long,long) [REMOVED]

    nextLong

    public long nextLong(long origin, long bound)
    Returns a pseudorandom long value between the specified origin (inclusive) and the specified bound (exclusive).
    Parameters:
    origin - the least value returned
    bound - the upper bound (exclusive)
    Returns:
    a pseudorandom long value between the origin (inclusive) and the bound (exclusive)
    Throws:
    IllegalArgumentException - if origin is greater than or equal to bound

    method:nextDouble() [REMOVED]

    nextDouble

    public double nextDouble()
    Returns a pseudorandom double value between zero (inclusive) and one (exclusive).
    Returns:
    a pseudorandom double value between zero (inclusive) and one (exclusive)

    method:nextDouble(double) [REMOVED]

    nextDouble

    public double nextDouble(double bound)
    Returns a pseudorandom double value between 0.0 (inclusive) and the specified bound (exclusive).
    Parameters:
    bound - the upper bound (exclusive). Must be positive.
    Returns:
    a pseudorandom double value between zero (inclusive) and the bound (exclusive)
    Throws:
    IllegalArgumentException - if bound is not positive

    method:nextDouble(double,double) [REMOVED]

    nextDouble

    public double nextDouble(double origin, double bound)
    Returns a pseudorandom double value between the specified origin (inclusive) and bound (exclusive).
    Parameters:
    origin - the least value returned
    bound - the upper bound (exclusive)
    Returns:
    a pseudorandom double value between the origin (inclusive) and the bound (exclusive)
    Throws:
    IllegalArgumentException - if origin is greater than or equal to bound

    method:nextBoolean() [REMOVED]

    nextBoolean

    public boolean nextBoolean()
    Returns a pseudorandom boolean value.
    Returns:
    a pseudorandom boolean value

    method:makeIntsSpliterator(long,long,int,int) [ADDED]

    makeIntsSpliterator

    public Spliterator.OfInt makeIntsSpliterator(long index, long fence, int origin, int bound)
    Create an instance of Spliterator.OfInt that for each traversal position between the specified index (inclusive) and the specified fence (exclusive) generates a (pseudo)randomly chosen int value between the specified origin (inclusive) and the specified bound (exclusive).
    Parameters:
    index - the (inclusive) lower bound on traversal positions
    fence - the (exclusive) upper bound on traversal positions
    origin - the (inclusive) lower bound on the (pseudo)random values to be generated
    bound - the (exclusive) upper bound on the (pseudo)random values to be generated
    Returns:
    an instance of Spliterator.OfInt

    method:makeLongsSpliterator(long,long,long,long) [ADDED]

    makeLongsSpliterator

    public Spliterator.OfLong makeLongsSpliterator(long index, long fence, long origin, long bound)
    Create an instance of Spliterator.OfLong that for each traversal position between the specified index (inclusive) and the specified fence (exclusive) generates a (pseudo)randomly chosen long value between the specified origin (inclusive) and the specified bound (exclusive).
    Parameters:
    index - the (inclusive) lower bound on traversal positions
    fence - the (exclusive) upper bound on traversal positions
    origin - the (inclusive) lower bound on the (pseudo)random values to be generated
    bound - the (exclusive) upper bound on the (pseudo)random values to be generated
    Returns:
    an instance of Spliterator.OfLong

    method:makeDoublesSpliterator(long,long,double,double) [ADDED]

    makeDoublesSpliterator

    public Spliterator.OfDouble makeDoublesSpliterator(long index, long fence, double origin, double bound)
    Create an instance of Spliterator.OfDouble that for each traversal position between the specified index (inclusive) and the specified fence (exclusive) generates a (pseudo)randomly chosen double value between the specified origin (inclusive) and the specified bound (exclusive).
    Parameters:
    index - the (inclusive) lower bound on traversal positions
    fence - the (exclusive) upper bound on traversal positions
    origin - the (inclusive) lower bound on the (pseudo)random values to be generated
    bound - the (exclusive) upper bound on the (pseudo)random values to be generated
    Returns:
    an instance of Spliterator.OfDouble

    method:splits() [ADDED]

    splits

    Returns an effectively unlimited stream of new (pseudo)random number generators, each of which implements the RandomGenerator.SplittableGenerator interface.

    This (pseudo)random number generator provides the entropy used to seed the new ones.

    Specified by:
    splits in interface RandomGenerator.SplittableGenerator
    Implementation Note:
    This method is implemented to be equivalent to splits(Long.MAX_VALUE).
    Returns:
    a stream of RandomGenerator.SplittableGenerator objects

    method:splits(long) [ADDED]

    splits

    public Stream<RandomGenerator.SplittableGenerator> splits(long streamSize)
    Returns a stream producing the given streamSize number of new (pseudo)random number generators, each of which implements the RandomGenerator.SplittableGenerator interface.

    This (pseudo)random number generator provides the entropy used to seed the new ones.

    Specified by:
    splits in interface RandomGenerator.SplittableGenerator
    Parameters:
    streamSize - the number of values to generate
    Returns:
    a stream of RandomGenerator.SplittableGenerator objects
    Throws:
    IllegalArgumentException - if streamSize is less than zero

    method:splits(java.util.random.RandomGenerator.SplittableGenerator) [ADDED]

    splits

    Returns an effectively unlimited stream of new (pseudo)random number generators, each of which implements the RandomGenerator.SplittableGenerator interface.
    Specified by:
    splits in interface RandomGenerator.SplittableGenerator
    Implementation Note:
    This method is implemented to be equivalent to splits(Long.MAX_VALUE).
    Parameters:
    source - a RandomGenerator.SplittableGenerator instance to be used instead of this one as a source of (pseudo)random bits used to initialize the state of the new ones.
    Returns:
    a stream of RandomGenerator.SplittableGenerator objects

    method:splits(long,java.util.random.RandomGenerator.SplittableGenerator) [ADDED]

    splits

    public Stream<RandomGenerator.SplittableGenerator> splits(long streamSize, RandomGenerator.SplittableGenerator source)
    Returns a stream producing the given streamSize number of new (pseudo)random number generators, each of which implements the RandomGenerator.SplittableGenerator interface.
    Specified by:
    splits in interface RandomGenerator.SplittableGenerator
    Parameters:
    streamSize - the number of values to generate
    source - a RandomGenerator.SplittableGenerator instance to be used instead of this one as a source of (pseudo)random bits used to initialize the state of the new ones.
    Returns:
    a stream of RandomGenerator.SplittableGenerator objects
    Throws:
    IllegalArgumentException - if streamSize is less than zero

    method:ints(long) [CHANGED]

    ints

    public IntStream ints(long streamSize)
    Returns a stream producing the given streamSize number of pseudorandom(pseudo)random int values from this generator and/or one split from it.

    The (pseudo)random int values are generated as if it's the result of calling the method RandomGenerator.nextInt().

    Specified by:
    ints in interface RandomGenerator
    Parameters:
    streamSize - the number of values to generate
    Returns:
    a stream of pseudorandom(pseudo)random int values
    Throws:
    IllegalArgumentException - if streamSize is less than zero

    ints

    public IntStream ints(long streamSize)
    Returns a stream producing the given streamSize number of pseudorandom int values from this generator and/or one split from it.
    Parameters:
    streamSize - the number of values to generate
    Returns:
    a stream of pseudorandom int values
    Throws:
    IllegalArgumentException - if streamSize is less than zero

    ints

    public IntStream ints(long streamSize)
    Returns a stream producing the given streamSize number of (pseudo)random int values from this generator and/or one split from it.

    The (pseudo)random int values are generated as if it's the result of calling the method RandomGenerator.nextInt().

    Specified by:
    ints in interface RandomGenerator
    Parameters:
    streamSize - the number of values to generate
    Returns:
    a stream of (pseudo)random int values
    Throws:
    IllegalArgumentException - if streamSize is less than zero

    method:ints() [CHANGED]

    ints

    public IntStream ints()
    Returns an effectively unlimited stream of pseudorandom(pseudo)randomly chosen int values.

    The (pseudo)random int values from this generator and/or one split from it.are generated as if the result of calling the method RandomGenerator.nextInt().

    Specified by:
    ints in interface RandomGenerator
    Implementation Note:
    ThisThe implementation of this method is implemented to beeffectively equivalent to ints(Long.MAX_VALUE).
    Returns:
    a stream of pseudorandom(pseudo)randomly chosen int values

    ints

    public IntStream ints()
    Returns an effectively unlimited stream of pseudorandom int values from this generator and/or one split from it.
    Implementation Note:
    This method is implemented to be equivalent to ints(Long.MAX_VALUE) .
    Returns:
    a stream of pseudorandom int values

    ints

    public IntStream ints()
    Returns an effectively unlimited stream of (pseudo)randomly chosen int values.

    The (pseudo)random int values are generated as if the result of calling the method RandomGenerator.nextInt().

    Specified by:
    ints in interface RandomGenerator
    Implementation Note:
    The implementation of this method is effectively equivalent to ints(Long.MAX_VALUE).
    Returns:
    a stream of (pseudo)randomly chosen int values

    method:ints(long,int,int) [CHANGED]

    ints

    public IntStream ints(long streamSize, int randomNumberOrigin, int randomNumberBound)
    Returns a stream producing the given streamSize number of pseudorandom(pseudo)random int values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).

    The (pseudo)random int values are generated as if the result of calling the following method with the origin and bound:

                                                                                                                 
     int nextInt(int origin, int bound) {
       int n = bound - origin;
       if (n > 0) {
         return nextInt(n) + origin;
       }
       else {  // range not representable as int
         int r;
         do {
           r = nextInt();
         } while (r < origin || r >= bound);
         return r;
       }
     }
                                                            
                                                

    Specified by:
    ints in interface RandomGenerator
    Parameters:
    streamSize - the number of values to generate
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of pseudorandom(pseudo)random int values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if streamSize is less than zero, or randomNumberOrigin is greater than or equal to randomNumberBound

    ints

    public IntStream ints(long streamSize, int randomNumberOrigin, int randomNumberBound)
    Returns a stream producing the given streamSize number of pseudorandom int values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).
    Parameters:
    streamSize - the number of values to generate
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of pseudorandom int values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if streamSize is less than zero, or randomNumberOrigin is greater than or equal to randomNumberBound

    ints

    public IntStream ints(long streamSize, int randomNumberOrigin, int randomNumberBound)
    Returns a stream producing the given streamSize number of (pseudo)random int values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).

    The (pseudo)random int values are generated as if the result of calling the following method with the origin and bound:

                                                                                                                 
     int nextInt(int origin, int bound) {
       int n = bound - origin;
       if (n > 0) {
         return nextInt(n) + origin;
       }
       else {  // range not representable as int
         int r;
         do {
           r = nextInt();
         } while (r < origin || r >= bound);
         return r;
       }
     }
                                                            
                                                

    Specified by:
    ints in interface RandomGenerator
    Parameters:
    streamSize - the number of values to generate
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of (pseudo)random int values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if streamSize is less than zero, or randomNumberOrigin is greater than or equal to randomNumberBound

    method:ints(int,int) [CHANGED]

    ints

    public IntStream ints(int randomNumberOrigin, int randomNumberBound)
    Returns an effectively unlimited stream of pseudorandom(pseudo)random int values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).

    The (pseudo)random int values are generated as if the result of calling the following method with the origin and bound:

                                                                                                                 
     int nextInt(int origin, int bound) {
       int n = bound - origin;
       if (n > 0) {
         return nextInt(n) + origin;
       }
       else {  // range not representable as int
         int r;
         do {
           r = nextInt();
         } while (r < origin || r >= bound);
         return r;
       }
     }
                                                            
                                                

    Specified by:
    ints in interface RandomGenerator
    Implementation Note:
    This method is implemented to be equivalent to ints(Long.MAX_VALUE, randomNumberOrigin, randomNumberBound) .
    Parameters:
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of pseudorandom(pseudo)random int values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if randomNumberOrigin is greater than or equal to randomNumberBound

    ints

    public IntStream ints(int randomNumberOrigin, int randomNumberBound)
    Returns an effectively unlimited stream of pseudorandom int values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).
    Implementation Note:
    This method is implemented to be equivalent to ints(Long.MAX_VALUE, randomNumberOrigin, randomNumberBound) .
    Parameters:
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of pseudorandom int values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if randomNumberOrigin is greater than or equal to randomNumberBound

    ints

    public IntStream ints(int randomNumberOrigin, int randomNumberBound)
    Returns an effectively unlimited stream of (pseudo)random int values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).

    The (pseudo)random int values are generated as if the result of calling the following method with the origin and bound:

                                                                                                                 
     int nextInt(int origin, int bound) {
       int n = bound - origin;
       if (n > 0) {
         return nextInt(n) + origin;
       }
       else {  // range not representable as int
         int r;
         do {
           r = nextInt();
         } while (r < origin || r >= bound);
         return r;
       }
     }
                                                            
                                                

    Specified by:
    ints in interface RandomGenerator
    Implementation Note:
    This method is implemented to be equivalent to ints(Long.MAX_VALUE, randomNumberOrigin, randomNumberBound) .
    Parameters:
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of (pseudo)random int values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if randomNumberOrigin is greater than or equal to randomNumberBound

    method:longs(long) [CHANGED]

    longs

    public LongStream longs(long streamSize)
    Returns a stream producing the given streamSize number of pseudorandom(pseudo)random long values from this generator and/or one split from it.

    The (pseudo)random long values are generated as if the result of calling the method RandomGenerator.nextLong().

    Specified by:
    longs in interface RandomGenerator
    Parameters:
    streamSize - the number of values to generate
    Returns:
    a stream of pseudorandom(pseudo)random long values
    Throws:
    IllegalArgumentException - if streamSize is less than zero

    longs

    public LongStream longs(long streamSize)
    Returns a stream producing the given streamSize number of pseudorandom long values from this generator and/or one split from it.
    Parameters:
    streamSize - the number of values to generate
    Returns:
    a stream of pseudorandom long values
    Throws:
    IllegalArgumentException - if streamSize is less than zero

    longs

    public LongStream longs(long streamSize)
    Returns a stream producing the given streamSize number of (pseudo)random long values from this generator and/or one split from it.

    The (pseudo)random long values are generated as if the result of calling the method RandomGenerator.nextLong().

    Specified by:
    longs in interface RandomGenerator
    Parameters:
    streamSize - the number of values to generate
    Returns:
    a stream of (pseudo)random long values
    Throws:
    IllegalArgumentException - if streamSize is less than zero

    method:longs() [CHANGED]

    longs

    public LongStream longs()
    Returns an effectively unlimited stream of pseudorandom(pseudo)random long values from this generator and/or one split from it.

    The (pseudo)random long values are generated as if the result of calling the method RandomGenerator.nextLong().

    Specified by:
    longs in interface RandomGenerator
    Implementation Note:
    This method is implemented to be equivalent to longs(Long.MAX_VALUE) .
    Returns:
    a stream of pseudorandom(pseudo)random long values

    longs

    public LongStream longs()
    Returns an effectively unlimited stream of pseudorandom long values from this generator and/or one split from it.
    Implementation Note:
    This method is implemented to be equivalent to longs(Long.MAX_VALUE) .
    Returns:
    a stream of pseudorandom long values

    longs

    public LongStream longs()
    Returns an effectively unlimited stream of (pseudo)random long values from this generator and/or one split from it.

    The (pseudo)random long values are generated as if the result of calling the method RandomGenerator.nextLong().

    Specified by:
    longs in interface RandomGenerator
    Implementation Note:
    This method is implemented to be equivalent to longs(Long.MAX_VALUE) .
    Returns:
    a stream of (pseudo)random long values

    method:longs(long,long,long) [CHANGED]

    longs

    public LongStream longs(long streamSize, long randomNumberOrigin, long randomNumberBound)
    Returns a stream producing the given streamSize number of pseudorandom(pseudo)random long values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).

    The (pseudo)random long values are generated as if the result of calling the following method with the origin and bound:

                                                                                                                 
     long nextLong(long origin, long bound) {
       long r = nextLong();
       long n = bound - origin, m = n - 1;
       if ((n & m) == 0L)  // power of two
         r = (r & m) + origin;
       else if (n > 0L) {  // reject over-represented candidates
         for (long u = r >>> 1;            // ensure nonnegative
              u + m - (r = u % n) < 0L;    // rejection check
              u = nextLong() >>> 1) // retry
             ;
         r += origin;
       }
       else {              // range not representable as long
         while (r < origin || r >= bound)
           r = nextLong();
       }
       return r;
     }
                                                            
                                                

    Specified by:
    longs in interface RandomGenerator
    Parameters:
    streamSize - the number of values to generate
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of pseudorandom(pseudo)random long values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if streamSize is less than zero, or randomNumberOrigin is greater than or equal to randomNumberBound

    longs

    public LongStream longs(long streamSize, long randomNumberOrigin, long randomNumberBound)
    Returns a stream producing the given streamSize number of pseudorandom long values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).
    Parameters:
    streamSize - the number of values to generate
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of pseudorandom long values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if streamSize is less than zero, or randomNumberOrigin is greater than or equal to randomNumberBound

    longs

    public LongStream longs(long streamSize, long randomNumberOrigin, long randomNumberBound)
    Returns a stream producing the given streamSize number of (pseudo)random long values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).

    The (pseudo)random long values are generated as if the result of calling the following method with the origin and bound:

                                                                                                                 
     long nextLong(long origin, long bound) {
       long r = nextLong();
       long n = bound - origin, m = n - 1;
       if ((n & m) == 0L)  // power of two
         r = (r & m) + origin;
       else if (n > 0L) {  // reject over-represented candidates
         for (long u = r >>> 1;            // ensure nonnegative
              u + m - (r = u % n) < 0L;    // rejection check
              u = nextLong() >>> 1) // retry
             ;
         r += origin;
       }
       else {              // range not representable as long
         while (r < origin || r >= bound)
           r = nextLong();
       }
       return r;
     }
                                                            
                                                

    Specified by:
    longs in interface RandomGenerator
    Parameters:
    streamSize - the number of values to generate
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of (pseudo)random long values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if streamSize is less than zero, or randomNumberOrigin is greater than or equal to randomNumberBound

    method:longs(long,long) [CHANGED]

    longs

    public LongStream longs(long randomNumberOrigin, long randomNumberBound)
    Returns an effectively unlimited stream of pseudorandom(pseudo)random long values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).

    The (pseudo)random long values are generated as if the result of calling the following method with the origin and bound:

                                                                                                                 
     long nextLong(long origin, long bound) {
       long r = nextLong();
       long n = bound - origin, m = n - 1;
       if ((n & m) == 0L)  // power of two
         r = (r & m) + origin;
       else if (n > 0L) {  // reject over-represented candidates
         for (long u = r >>> 1;            // ensure nonnegative
              u + m - (r = u % n) < 0L;    // rejection check
              u = nextLong() >>> 1) // retry
             ;
         r += origin;
       }
       else {              // range not representable as long
         while (r < origin || r >= bound)
           r = nextLong();
       }
       return r;
     }
                                                            
                                                

    Specified by:
    longs in interface RandomGenerator
    Implementation Note:
    This method is implemented to be equivalent to longs(Long.MAX_VALUE, randomNumberOrigin, randomNumberBound) .
    Parameters:
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of pseudorandom(pseudo)random long values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if randomNumberOrigin is greater than or equal to randomNumberBound

    longs

    public LongStream longs(long randomNumberOrigin, long randomNumberBound)
    Returns an effectively unlimited stream of pseudorandom long values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).
    Implementation Note:
    This method is implemented to be equivalent to longs(Long.MAX_VALUE, randomNumberOrigin, randomNumberBound) .
    Parameters:
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of pseudorandom long values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if randomNumberOrigin is greater than or equal to randomNumberBound

    longs

    public LongStream longs(long randomNumberOrigin, long randomNumberBound)
    Returns an effectively unlimited stream of (pseudo)random long values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).

    The (pseudo)random long values are generated as if the result of calling the following method with the origin and bound:

                                                                                                                 
     long nextLong(long origin, long bound) {
       long r = nextLong();
       long n = bound - origin, m = n - 1;
       if ((n & m) == 0L)  // power of two
         r = (r & m) + origin;
       else if (n > 0L) {  // reject over-represented candidates
         for (long u = r >>> 1;            // ensure nonnegative
              u + m - (r = u % n) < 0L;    // rejection check
              u = nextLong() >>> 1) // retry
             ;
         r += origin;
       }
       else {              // range not representable as long
         while (r < origin || r >= bound)
           r = nextLong();
       }
       return r;
     }
                                                            
                                                

    Specified by:
    longs in interface RandomGenerator
    Implementation Note:
    This method is implemented to be equivalent to longs(Long.MAX_VALUE, randomNumberOrigin, randomNumberBound) .
    Parameters:
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of (pseudo)random long values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if randomNumberOrigin is greater than or equal to randomNumberBound

    method:doubles(long) [CHANGED]

    doubles

    public DoubleStream doubles(long streamSize)
    Returns a stream producing the given streamSize number of pseudorandom(pseudo)random double values from this generator and/or one split from it; each value is between zero (inclusive) and one (exclusive).

    The pseudorandom double values are generated as ifs the result of calling the method RandomGenerator.nextDouble().

    Specified by:
    doubles in interface RandomGenerator
    Parameters:
    streamSize - the number of values to generate
    Returns:
    a stream of double values
    Throws:
    IllegalArgumentException - if streamSize is less than zero

    doubles

    public DoubleStream doubles(long streamSize)
    Returns a stream producing the given streamSize number of pseudorandom double values from this generator and/or one split from it; each value is between zero (inclusive) and one (exclusive).
    Parameters:
    streamSize - the number of values to generate
    Returns:
    a stream of double values
    Throws:
    IllegalArgumentException - if streamSize is less than zero

    doubles

    public DoubleStream doubles(long streamSize)
    Returns a stream producing the given streamSize number of (pseudo)random double values from this generator and/or one split from it; each value is between zero (inclusive) and one (exclusive).

    The pseudorandom double values are generated as ifs the result of calling the method RandomGenerator.nextDouble().

    Specified by:
    doubles in interface RandomGenerator
    Parameters:
    streamSize - the number of values to generate
    Returns:
    a stream of double values
    Throws:
    IllegalArgumentException - if streamSize is less than zero

    method:doubles() [CHANGED]

    doubles

    public DoubleStream doubles()
    Returns an effectively unlimited stream of pseudorandom(pseudo)random double values from this generator and/or one split from it; each value is between zero (inclusive) and one (exclusive).

    The (pseudo)random double values are generated as if the result of calling the method RandomGenerator.nextDouble().

    Specified by:
    doubles in interface RandomGenerator
    Implementation Note:
    This method is implemented to be equivalent to doubles(Long.MAX_VALUE) .
    Returns:
    a stream of pseudorandom(pseudo)random double values

    doubles

    public DoubleStream doubles()
    Returns an effectively unlimited stream of pseudorandom double values from this generator and/or one split from it; each value is between zero (inclusive) and one (exclusive).
    Implementation Note:
    This method is implemented to be equivalent to doubles(Long.MAX_VALUE) .
    Returns:
    a stream of pseudorandom double values

    doubles

    public DoubleStream doubles()
    Returns an effectively unlimited stream of (pseudo)random double values from this generator and/or one split from it; each value is between zero (inclusive) and one (exclusive).

    The (pseudo)random double values are generated as if the result of calling the method RandomGenerator.nextDouble().

    Specified by:
    doubles in interface RandomGenerator
    Implementation Note:
    This method is implemented to be equivalent to doubles(Long.MAX_VALUE) .
    Returns:
    a stream of (pseudo)random double values

    method:doubles(long,double,double) [CHANGED]

    doubles

    public DoubleStream doubles(long streamSize, double randomNumberOrigin, double randomNumberBound)
    Returns a stream producing the given streamSize number of pseudorandom(pseudo)random double values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).

    The (pseudo)random double values are generated as if the result of calling the following method with the origin and bound:

                                                                                                                 
     double nextDouble(double origin, double bound) {
       double r = nextDouble();
       r = r * (bound - origin) + origin;
       if (r >= bound) // correct for rounding
         r = Math.nextDown(bound);
       return r;
     }
                                                            
                                                

    Specified by:
    doubles in interface RandomGenerator
    Parameters:
    streamSize - the number of values to generate
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of pseudorandom(pseudo)random double values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if streamSize is less than zero
    , orIllegalArgumentException - if randomNumberOrigin is greater than or equal to randomNumberBound

    doubles

    public DoubleStream doubles(long streamSize, double randomNumberOrigin, double randomNumberBound)
    Returns a stream producing the given streamSize number of pseudorandom double values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).
    Parameters:
    streamSize - the number of values to generate
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of pseudorandom double values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if streamSize is less than zero, or randomNumberOrigin is greater than or equal to randomNumberBound

    doubles

    public DoubleStream doubles(long streamSize, double randomNumberOrigin, double randomNumberBound)
    Returns a stream producing the given streamSize number of (pseudo)random double values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).

    The (pseudo)random double values are generated as if the result of calling the following method with the origin and bound:

                                                                                                                 
     double nextDouble(double origin, double bound) {
       double r = nextDouble();
       r = r * (bound - origin) + origin;
       if (r >= bound) // correct for rounding
         r = Math.nextDown(bound);
       return r;
     }
                                                            
                                                

    Specified by:
    doubles in interface RandomGenerator
    Parameters:
    streamSize - the number of values to generate
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of (pseudo)random double values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if streamSize is less than zero
    IllegalArgumentException - if randomNumberOrigin is greater than or equal to randomNumberBound

    method:doubles(double,double) [CHANGED]

    doubles

    public DoubleStream doubles(double randomNumberOrigin, double randomNumberBound)
    Returns an effectively unlimited stream of pseudorandom(pseudo)random double values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).

    The (pseudo)random double values are generated as if the result of calling the following method with the origin and bound:

                                                                                                                 
     double nextDouble(double origin, double bound) {
       double r = nextDouble();
       r = r * (bound - origin) + origin;
       if (r >= bound) // correct for rounding
         r = Math.nextDown(bound);
       return r;
     }
                                                            
                                                

    Specified by:
    doubles in interface RandomGenerator
    Implementation Note:
    This method is implemented to be equivalent to doubles(Long.MAX_VALUE, randomNumberOrigin, randomNumberBound) .
    Parameters:
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of pseudorandom(pseudo)random double values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if randomNumberOrigin is greater than or equal to randomNumberBound

    doubles

    public DoubleStream doubles(double randomNumberOrigin, double randomNumberBound)
    Returns an effectively unlimited stream of pseudorandom double values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).
    Implementation Note:
    This method is implemented to be equivalent to doubles(Long.MAX_VALUE, randomNumberOrigin, randomNumberBound) .
    Parameters:
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of pseudorandom double values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if randomNumberOrigin is greater than or equal to randomNumberBound

    doubles

    public DoubleStream doubles(double randomNumberOrigin, double randomNumberBound)
    Returns an effectively unlimited stream of (pseudo)random double values from this generator and/or one split from it; each value conforms to the given origin (inclusive) and bound (exclusive).

    The (pseudo)random double values are generated as if the result of calling the following method with the origin and bound:

                                                                                                                 
     double nextDouble(double origin, double bound) {
       double r = nextDouble();
       r = r * (bound - origin) + origin;
       if (r >= bound) // correct for rounding
         r = Math.nextDown(bound);
       return r;
     }
                                                            
                                                

    Specified by:
    doubles in interface RandomGenerator
    Implementation Note:
    This method is implemented to be equivalent to doubles(Long.MAX_VALUE, randomNumberOrigin, randomNumberBound) .
    Parameters:
    randomNumberOrigin - the origin (inclusive) of each random value
    randomNumberBound - the bound (exclusive) of each random value
    Returns:
    a stream of (pseudo)random double values, each with the given origin (inclusive) and bound (exclusive)
    Throws:
    IllegalArgumentException - if randomNumberOrigin is greater than or equal to randomNumberBound