6.90. kink/random/RNG

Random number generators.

6.90.1. type rng

Abstract type of random number generator.

6.90.1.1. Rng.gen_int(Upper_bound)

`gen_int` produces a random int num in the range [0, Upper_bound).

Preconditions:

• `Upper_bound` must be an int num

• `Upper_bound` must be greater than or equal to 1

Every int nums in the range should be produced with approximately equal probability.

Example:

6.90.1.2. Rng.gen_bin(Size)

`gen_bin` produces a bin of the `Size` bits of which is randomly determined.

Preconditions:

• `Size` must be a non-negative int num

Probability of `1` bits and `0` bits should be approximately equal.

Example:

6.90.1.3. Rng.gen_bool

`gen_bool` produces a random bool.

Probability of true and false should be approximately equal.

Example:

6.90.2. RNG.is?(Val)

`is?` returns whether `Val` is an rng val.