Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# StreamableGenerator

```
interface StreamableGenerator : RandomGenerator
```

|---|
| [java.util.random.RandomGenerator.StreamableGenerator](https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.StreamableGenerator#) |

|---|
| Known Direct Subclasses [RandomGenerator.JumpableGenerator](https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.JumpableGenerator), [RandomGenerator.SplittableGenerator](https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.SplittableGenerator) |---|---| | [RandomGenerator.JumpableGenerator](https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.JumpableGenerator) | 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. 2 | | [RandomGenerator.SplittableGenerator](https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.SplittableGenerator) | 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). | |

|---|
| Known Indirect Subclasses [RandomGenerator.ArbitrarilyJumpableGenerator](https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.ArbitrarilyJumpableGenerator), [RandomGenerator.LeapableGenerator](https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.LeapableGenerator), [SplittableRandom](https://developer.android.com/reference/kotlin/java/util/SplittableRandom.html#) |---|---| | [RandomGenerator.ArbitrarilyJumpableGenerator](https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.ArbitrarilyJumpableGenerator) | 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. | | [RandomGenerator.LeapableGenerator](https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.LeapableGenerator) | 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. 2 | | [SplittableRandom](https://developer.android.com/reference/kotlin/java/util/SplittableRandom.html#) | A generator of uniform pseudorandom values (with period 264) applicable for use in (among other contexts) isolated parallel computations that may generate subtasks. | |

The `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.StreamableGenerator#` interface augments the `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator` interface to provide methods that return streams of `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator` objects. Ideally, such a stream of objects would have the property that the behavior of each object is statistically independent of all the others. In practice, one may have to settle for some approximation to this property.

A generator that implements interface `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.SplittableGenerator` may choose to use its java.util.random.RandomGenerator.SplittableGenerator#splits() method to implement the java.util.random.RandomGenerator.StreamableGenerator#rngs() method required by this interface.

A generator that implements interface `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.JumpableGenerator` may choose to use its `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.JumpableGenerator#jumps()`() method to implement the `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.StreamableGenerator#rngs()`() method required by this interface.

A generator that implements interface `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.LeapableGenerator` may choose to use its `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.LeapableGenerator#leaps()`() method to implement the `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.StreamableGenerator#rngs()`() method required by this interface.

Objects that implement `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.StreamableGenerator#` are typically not cryptographically secure. Consider instead using `https://developer.android.com/reference/kotlin/java/security/SecureRandom.html#` to get a cryptographically secure pseudo-random number generator for use by security-sensitive applications.

## Summary

| Public methods ||
|---|---|
| open static [RandomGenerator.StreamableGenerator](https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.StreamableGenerator#)! | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.StreamableGenerator#of(kotlin.String)(name: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Returns an instance of `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.StreamableGenerator#` that utilizes the `name` [algorithm](https://developer.android.com/reference/kotlin/java/util/random/package-summary#algorithms). |
| abstract [Stream](https://developer.android.com/reference/kotlin/java/util/stream/Stream.html#)\<[RandomGenerator](https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator)!\>! | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.StreamableGenerator#rngs()()` Returns an effectively unlimited stream of objects, each of which implements the `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator` interface. |
| open [Stream](https://developer.android.com/reference/kotlin/java/util/stream/Stream.html#)\<[RandomGenerator](https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator)!\>! | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.StreamableGenerator#rngs(kotlin.Long)(streamSize: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Returns an effectively unlimited stream of objects, each of which implements the `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator` interface. |

| Inherited functions ||
|---|---|
| From class `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator` |---|---| | `https://developer.android.com/reference/kotlin/java/util/stream/DoubleStream.html#!` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#doubles()()` Returns an effectively unlimited stream of pseudorandomly chosen `double` values. <br /> | | `https://developer.android.com/reference/kotlin/java/util/stream/DoubleStream.html#!` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#doubles(kotlin.Double,%20kotlin.Double)(randomNumberOrigin: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html, randomNumberBound: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)` Returns an effectively unlimited stream of pseudorandomly chosen `double` values, where each value is between the specified origin (inclusive) and the specified bound (exclusive). <br /> | | `https://developer.android.com/reference/kotlin/java/util/stream/DoubleStream.html#!` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#doubles(kotlin.Long)(streamSize: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Returns a stream producing the given `streamSize` number of pseudorandomly chosen `double` values. <br /> | | `https://developer.android.com/reference/kotlin/java/util/stream/DoubleStream.html#!` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#doubles(kotlin.Long,%20kotlin.Double,%20kotlin.Double)(streamSize: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html, randomNumberOrigin: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html, randomNumberBound: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)` Returns a stream producing the given `streamSize` number of pseudorandomly chosen `double` values, where each value is between the specified origin (inclusive) and the specified bound (exclusive). <br /> | | `https://developer.android.com/reference/kotlin/java/util/stream/IntStream.html#!` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#ints()()` Returns an effectively unlimited stream of pseudorandomly chosen `int` values. <br /> | | `https://developer.android.com/reference/kotlin/java/util/stream/IntStream.html#!` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#ints(kotlin.Int,%20kotlin.Int)(randomNumberOrigin: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, randomNumberBound: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Returns an effectively unlimited stream of pseudorandomly chosen `int` values, where each value is between the specified origin (inclusive) and the specified bound (exclusive). <br /> | | `https://developer.android.com/reference/kotlin/java/util/stream/IntStream.html#!` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#ints(kotlin.Long)(streamSize: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Returns a stream producing the given `streamSize` number of pseudorandomly chosen `int` values. <br /> | | `https://developer.android.com/reference/kotlin/java/util/stream/IntStream.html#!` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#ints(kotlin.Long,%20kotlin.Int,%20kotlin.Int)(streamSize: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html, randomNumberOrigin: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, randomNumberBound: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Returns a stream producing the given `streamSize` number of pseudorandomly chosen `int` values, where each value is between the specified origin (inclusive) and the specified bound (exclusive). <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#isDeprecated()()` Return true if the implementation of RandomGenerator (algorithm) has been marked for deprecation. <br /> | | `https://developer.android.com/reference/kotlin/java/util/stream/LongStream.html#!` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#longs()()` Returns an effectively unlimited stream of pseudorandomly chosen `long` values. <br /> | | `https://developer.android.com/reference/kotlin/java/util/stream/LongStream.html#!` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#longs(kotlin.Long)(streamSize: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Returns a stream producing the given `streamSize` number of pseudorandomly chosen `long` values. <br /> | | `https://developer.android.com/reference/kotlin/java/util/stream/LongStream.html#!` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#longs(kotlin.Long,%20kotlin.Long)(randomNumberOrigin: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html, randomNumberBound: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Returns an effectively unlimited stream of pseudorandomly chosen `long` values, where each value is between the specified origin (inclusive) and the specified bound (exclusive). <br /> | | `https://developer.android.com/reference/kotlin/java/util/stream/LongStream.html#!` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#longs(kotlin.Long,%20kotlin.Long,%20kotlin.Long)(streamSize: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html, randomNumberOrigin: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html, randomNumberBound: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Returns a stream producing the given `streamSize` number of pseudorandomly chosen `long` values, where each value is between the specified origin (inclusive) and the specified bound (exclusive). <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextBoolean()()` Returns a pseudorandomly chosen `boolean` value. The default implementation tests the high-order bit (sign bit) of a value produced by `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextInt()`(), on the grounds that some algorithms for pseudorandom number generation produce values whose high-order bits have better statistical quality than the low-order bits. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextBytes(kotlin.ByteArray)(bytes: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html!)` Fills a user-supplied byte array with generated byte values pseudorandomly chosen uniformly from the range of values between -128 (inclusive) and 127 (inclusive). <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextDouble()()` Returns a pseudorandom `double` value between zero (inclusive) and one (exclusive). <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextDouble(kotlin.Double)(bound: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)` Returns a pseudorandomly chosen `double` value between zero (inclusive) and the specified bound (exclusive). <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextDouble(kotlin.Double,%20kotlin.Double)(origin: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html, bound: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)` Returns a pseudorandomly chosen `double` value between the specified origin (inclusive) and the specified bound (exclusive). <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextExponential()()` Returns a nonnegative `double` value pseudorandomly chosen from an exponential distribution whose mean is 1. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextFloat()()` Returns a pseudorandom `float` value between zero (inclusive) and one (exclusive). <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextFloat(kotlin.Float)(bound: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)` Returns a pseudorandomly chosen `float` value between zero (inclusive) and the specified bound (exclusive). <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextFloat(kotlin.Float,%20kotlin.Float)(origin: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html, bound: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)` Returns a pseudorandomly chosen `float` value between the specified origin (inclusive) and the specified bound (exclusive). <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextGaussian()()` Returns a `double` value pseudorandomly chosen from a Gaussian (normal) distribution whose mean is 0 and whose standard deviation is 1. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextGaussian(kotlin.Double,%20kotlin.Double)(mean: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html, stddev: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-double/index.html)` Returns a `double` value pseudorandomly chosen from a Gaussian (normal) distribution with a mean and standard deviation specified by the arguments. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextInt()()` Returns a pseudorandomly chosen `int` value. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextInt(kotlin.Int)(bound: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Returns a pseudorandomly chosen `int` value between zero (inclusive) and the specified bound (exclusive). <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextInt(kotlin.Int,%20kotlin.Int)(origin: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, bound: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Returns a pseudorandomly chosen `int` value between the specified origin (inclusive) and the specified bound (exclusive). <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextLong()()` Returns a pseudorandomly chosen `long` value. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextLong(kotlin.Long)(bound: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Returns a pseudorandomly chosen `long` value between zero (inclusive) and the specified bound (exclusive). <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator#nextLong(kotlin.Long,%20kotlin.Long)(origin: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html, bound: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Returns a pseudorandomly chosen `long` value between the specified origin (inclusive) and the specified bound (exclusive). <br /> | ||

## Public methods

### of

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open static fun of(name: String!): RandomGenerator.StreamableGenerator!
```

Returns an instance of `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.StreamableGenerator#` that utilizes the `name` [algorithm](https://developer.android.com/reference/kotlin/java/util/random/package-summary#algorithms).

| Parameters ||
|---|---|
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: Name of random number generator [algorithm](https://developer.android.com/reference/kotlin/java/util/random/package-summary#algorithms) |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.StreamableGenerator#!` | An instance of `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator.StreamableGenerator#` |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if the named algorithm is not found |
| `java.lang.NullPointerException` | if name is null |

### rngs

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
abstract fun rngs(): Stream<RandomGenerator!>!
```

Returns an effectively unlimited stream of objects, each of which implements the `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator` interface. Ideally the generators in the stream will appear to be statistically independent. The new generators are of the same [algorithm](https://developer.android.com/reference/kotlin/java/util/random/package-summary#algorithms) as this generator.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/java/util/stream/Stream.html#<https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator!>!` | a stream of objects that implement the `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator` interface |

### rngs

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun rngs(streamSize: Long): Stream<RandomGenerator!>!
```

Returns an effectively unlimited stream of objects, each of which implements the `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator` interface. Ideally the generators in the stream will appear to be statistically independent. The new generators are of the same [algorithm](https://developer.android.com/reference/kotlin/java/util/random/package-summary#algorithms) as this generator.

| Parameters ||
|---|---|
| `streamSize` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): the number of generators to generate |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/java/util/stream/Stream.html#<https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator!>!` | a stream of objects that implement the `https://developer.android.com/reference/kotlin/java/util/random/RandomGenerator` interface |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if `streamSize` is less than zero |