Interface SplittableUniformRandomProvider

  • All Superinterfaces:
    UniformRandomProvider
    All Known Implementing Classes:
    L128X1024Mix, L128X128Mix, L128X256Mix, L32X64Mix, L64X1024Mix, L64X128Mix, L64X128StarStar, L64X256Mix

    public interface SplittableUniformRandomProvider
    extends UniformRandomProvider
    Applies to generators that can be split into two objects (the original and a new instance) each of which implements the same interface (and can be recursively split indefinitely). It is assumed that the two generators resulting from a split can be used concurrently on different threads.

    Ideally all generators produced by recursive splitting from the original object are statistically independent and individually uniform. In this case it would be expected that the set of values collectively generated from a group of split generators would have the same statistical properties as the same number of values produced from a single generator object.

    Since:
    1.5
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default java.util.stream.DoubleStream doubles()
      Returns an effectively unlimited stream of double values between 0 (inclusive) and 1 (exclusive).
      default java.util.stream.DoubleStream doubles​(double origin, double bound)
      Returns an effectively unlimited stream of double values between the specified origin (inclusive) and the specified bound (exclusive).
      default java.util.stream.DoubleStream doubles​(long streamSize)
      Returns a stream producing the given streamSize number of double values between 0 (inclusive) and 1 (exclusive).
      default java.util.stream.DoubleStream doubles​(long streamSize, double origin, double bound)
      Returns a stream producing the given streamSize number of double values between the specified origin (inclusive) and the specified bound (exclusive).
      default java.util.stream.IntStream ints()
      Returns an effectively unlimited stream of int values.
      default java.util.stream.IntStream ints​(int origin, int bound)
      Returns an effectively unlimited stream of int values between the specified origin (inclusive) and the specified bound (exclusive).
      default java.util.stream.IntStream ints​(long streamSize)
      Returns a stream producing the given streamSize number of int values.
      default java.util.stream.IntStream ints​(long streamSize, int origin, int bound)
      Returns a stream producing the given streamSize number of int values between the specified origin (inclusive) and the specified bound (exclusive).
      default java.util.stream.LongStream longs()
      Returns an effectively unlimited stream of long values.
      default java.util.stream.LongStream longs​(long streamSize)
      Returns a stream producing the given streamSize number of long values.
      default java.util.stream.LongStream longs​(long origin, long bound)
      Returns an effectively unlimited stream of long values between the specified origin (inclusive) and the specified bound (exclusive).
      default java.util.stream.LongStream longs​(long streamSize, long origin, long bound)
      Returns a stream producing the given streamSize number of long values between the specified origin (inclusive) and the specified bound (exclusive).
      default SplittableUniformRandomProvider split()
      Creates a new random generator, split off from this one, that implements the SplittableUniformRandomProvider interface.
      SplittableUniformRandomProvider split​(UniformRandomProvider source)
      Creates a new random generator, split off from this one, that implements the SplittableUniformRandomProvider interface.
      default java.util.stream.Stream<SplittableUniformRandomProvider> splits()
      Returns an effectively unlimited stream of new random generators, each of which implements the SplittableUniformRandomProvider interface.
      default java.util.stream.Stream<SplittableUniformRandomProvider> splits​(long streamSize)
      Returns a stream producing the given streamSize number of new random generators, each of which implements the SplittableUniformRandomProvider interface.
      default java.util.stream.Stream<SplittableUniformRandomProvider> splits​(long streamSize, SplittableUniformRandomProvider source)
      Returns a stream producing the given streamSize number of new random generators, each of which implements the SplittableUniformRandomProvider interface.
      default java.util.stream.Stream<SplittableUniformRandomProvider> splits​(SplittableUniformRandomProvider source)
      Returns an effectively unlimited stream of new random generators, each of which implements the SplittableUniformRandomProvider interface.
    • Method Detail

      • split

        default SplittableUniformRandomProvider split()
        Creates a new random generator, split off from this one, that implements the SplittableUniformRandomProvider interface.

        The current generator may be used a source of randomness to initialise the new instance. In this case repeat invocations of this method will return objects with a different initial state that are expected to be statistically independent.

        Returns:
        A new instance.
      • splits

        default java.util.stream.Stream<SplittableUniformRandomProvider> splits()
        Returns an effectively unlimited stream of new random generators, each of which implements the SplittableUniformRandomProvider interface.

        The current generator may be used a source of randomness to initialise the new instances.

        Returns:
        a stream of random generators.
      • splits

        default java.util.stream.Stream<SplittableUniformRandomProvider> splits​(SplittableUniformRandomProvider source)
        Returns an effectively unlimited stream of new random generators, each of which implements the SplittableUniformRandomProvider interface.
        Parameters:
        source - A source of randomness used to initialise the new instances; this may be split to provide a source of randomness across a parallel stream.
        Returns:
        a stream of random generators.
        Throws:
        java.lang.NullPointerException - if source is null
      • splits

        default java.util.stream.Stream<SplittableUniformRandomProvider> splits​(long streamSize)
        Returns a stream producing the given streamSize number of new random generators, each of which implements the SplittableUniformRandomProvider interface.

        The current generator may be used a source of randomness to initialise the new instances.

        Parameters:
        streamSize - Number of objects to generate.
        Returns:
        a stream of random generators; the stream is limited to the given streamSize.
        Throws:
        java.lang.IllegalArgumentException - if streamSize is negative.
      • splits

        default java.util.stream.Stream<SplittableUniformRandomProvider> splits​(long streamSize,
                                                                                SplittableUniformRandomProvider source)
        Returns a stream producing the given streamSize number of new random generators, each of which implements the SplittableUniformRandomProvider interface.
        Parameters:
        streamSize - Number of objects to generate.
        source - A source of randomness used to initialise the new instances; this may be split to provide a source of randomness across a parallel stream.
        Returns:
        a stream of random generators; the stream is limited to the given streamSize.
        Throws:
        java.lang.IllegalArgumentException - if streamSize is negative.
        java.lang.NullPointerException - if source is null
      • ints

        default java.util.stream.IntStream ints()
        Description copied from interface: UniformRandomProvider
        Returns an effectively unlimited stream of int values.
        Specified by:
        ints in interface UniformRandomProvider
        Returns:
        a stream of random int values.
      • ints

        default java.util.stream.IntStream ints​(int origin,
                                                int bound)
        Description copied from interface: UniformRandomProvider
        Returns an effectively unlimited stream of int values between the specified origin (inclusive) and the specified bound (exclusive).
        Specified by:
        ints in interface UniformRandomProvider
        Parameters:
        origin - Lower bound on the random number to be returned.
        bound - Upper bound (exclusive) on the random number to be returned.
        Returns:
        a stream of random values between the specified origin (inclusive) and the specified bound (exclusive).
      • ints

        default java.util.stream.IntStream ints​(long streamSize)
        Description copied from interface: UniformRandomProvider
        Returns a stream producing the given streamSize number of int values.
        Specified by:
        ints in interface UniformRandomProvider
        Parameters:
        streamSize - Number of values to generate.
        Returns:
        a stream of random int values; the stream is limited to the given streamSize.
      • ints

        default java.util.stream.IntStream ints​(long streamSize,
                                                int origin,
                                                int bound)
        Description copied from interface: UniformRandomProvider
        Returns a stream producing the given streamSize number of int values between the specified origin (inclusive) and the specified bound (exclusive).
        Specified by:
        ints in interface UniformRandomProvider
        Parameters:
        streamSize - Number of values to generate.
        origin - Lower bound on the random number to be returned.
        bound - Upper bound (exclusive) on the random number to be returned.
        Returns:
        a stream of random values between the specified origin (inclusive) and the specified bound (exclusive); the stream is limited to the given streamSize.
      • longs

        default java.util.stream.LongStream longs()
        Description copied from interface: UniformRandomProvider
        Returns an effectively unlimited stream of long values.
        Specified by:
        longs in interface UniformRandomProvider
        Returns:
        a stream of random long values.
      • longs

        default java.util.stream.LongStream longs​(long origin,
                                                  long bound)
        Description copied from interface: UniformRandomProvider
        Returns an effectively unlimited stream of long values between the specified origin (inclusive) and the specified bound (exclusive).
        Specified by:
        longs in interface UniformRandomProvider
        Parameters:
        origin - Lower bound on the random number to be returned.
        bound - Upper bound (exclusive) on the random number to be returned.
        Returns:
        a stream of random values between the specified origin (inclusive) and the specified bound (exclusive).
      • longs

        default java.util.stream.LongStream longs​(long streamSize)
        Description copied from interface: UniformRandomProvider
        Returns a stream producing the given streamSize number of long values.
        Specified by:
        longs in interface UniformRandomProvider
        Parameters:
        streamSize - Number of values to generate.
        Returns:
        a stream of random long values; the stream is limited to the given streamSize.
      • longs

        default java.util.stream.LongStream longs​(long streamSize,
                                                  long origin,
                                                  long bound)
        Description copied from interface: UniformRandomProvider
        Returns a stream producing the given streamSize number of long values between the specified origin (inclusive) and the specified bound (exclusive).
        Specified by:
        longs in interface UniformRandomProvider
        Parameters:
        streamSize - Number of values to generate.
        origin - Lower bound on the random number to be returned.
        bound - Upper bound (exclusive) on the random number to be returned.
        Returns:
        a stream of random values between the specified origin (inclusive) and the specified bound (exclusive); the stream is limited to the given streamSize.
      • doubles

        default java.util.stream.DoubleStream doubles()
        Description copied from interface: UniformRandomProvider
        Returns an effectively unlimited stream of double values between 0 (inclusive) and 1 (exclusive).
        Specified by:
        doubles in interface UniformRandomProvider
        Returns:
        a stream of random values between 0 (inclusive) and 1 (exclusive).
      • doubles

        default java.util.stream.DoubleStream doubles​(double origin,
                                                      double bound)
        Description copied from interface: UniformRandomProvider
        Returns an effectively unlimited stream of double values between the specified origin (inclusive) and the specified bound (exclusive).
        Specified by:
        doubles in interface UniformRandomProvider
        Parameters:
        origin - Lower bound on the random number to be returned.
        bound - Upper bound (exclusive) on the random number to be returned.
        Returns:
        a stream of random values between the specified origin (inclusive) and the specified bound (exclusive).
      • doubles

        default java.util.stream.DoubleStream doubles​(long streamSize)
        Description copied from interface: UniformRandomProvider
        Returns a stream producing the given streamSize number of double values between 0 (inclusive) and 1 (exclusive).
        Specified by:
        doubles in interface UniformRandomProvider
        Parameters:
        streamSize - Number of values to generate.
        Returns:
        a stream of random values between 0 (inclusive) and 1 (exclusive); the stream is limited to the given streamSize.
      • doubles

        default java.util.stream.DoubleStream doubles​(long streamSize,
                                                      double origin,
                                                      double bound)
        Description copied from interface: UniformRandomProvider
        Returns a stream producing the given streamSize number of double values between the specified origin (inclusive) and the specified bound (exclusive).
        Specified by:
        doubles in interface UniformRandomProvider
        Parameters:
        streamSize - Number of values to generate.
        origin - Lower bound on the random number to be returned.
        bound - Upper bound (exclusive) on the random number to be returned.
        Returns:
        a stream of random values between the specified origin (inclusive) and the specified bound (exclusive); the stream is limited to the given streamSize.