← Standard library

Random

sealed class Random
import Random from Wax;

A deterministic pseudo-random generator using xoshiro256**, seeded with a uint64.

Equal seeds produce equal sequences. A zero seed is treated as one.

import Random from Wax;
api fn Main() : int32 {
    var random = new Random(42ul);
    int32 die = random.NextInRange(1, 7);
    return die >= 1 && die < 7 ? 1 : 0;
}

Random.wax:15

Inherits from object. Follow these links for inherited members.

Members

constructorconstructor

public constructor (uint64 seed)

Initializes deterministic xoshiro256** state from a seed; zero is treated as one. Not suitable for cryptographic randomness.

Random.wax:25

Stepmethod

public fn Step() : uint64

Advances the generator state once and returns the next 64-bit output, like NextUInt64.

Random.wax:56

NextUInt64method

public fn NextUInt64() : uint64

Returns a random value using all 64 bits.

Random.wax:70

NextInt64method

public fn NextInt64() : int64

Returns a random signed 64-bit value.

Random.wax:75

NextUInt32method

public fn NextUInt32() : uint32

Returns a random unsigned 32-bit value.

Random.wax:80

NextInt32method

public fn NextInt32() : int32

Returns a non-negative random 31-bit integer.

Random.wax:85

NextFloatmethod

public fn NextFloat() : float

Returns a value in [0, 1) with 24 bits of precision.

Random.wax:90

NextDoublemethod

public fn NextDouble() : double

Returns a value in [0, 1) with 53 bits of precision.

Random.wax:96

NextBoolmethod

public fn NextBool() : bool

Returns a random Boolean.

Random.wax:102

NextInRangemethod

public fn NextInRange(int32 min, int32 max) : int32

Returns an integer in [min, max) using unbiased rejection sampling.

Random.wax:107