Documentation
¶
Index ¶
- func Bool(ctx context.Context) (runtime.Value, error)
- func Choice(ctx context.Context, values runtime.Value) (runtime.Value, error)
- func Float(ctx context.Context, args ...runtime.Value) (runtime.Value, error)
- func Int(ctx context.Context, min, max runtime.Value) (runtime.Value, error)
- func RegisterLib(ns runtime.Namespace)
- func Shuffle(ctx context.Context, values runtime.Value) (_ runtime.Value, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bool ¶
bool draws a non-cryptographic pseudo-random Boolean from the Session source. @return {Boolean} True or false with equal probability, consuming the shared random sequence.
func Choice ¶
choice selects one uniformly distributed value using the Session's pseudo-random source. Reservoir sampling takes O(n) time and O(1) additional storage. @param values {Any[]} Input list, traversed once without copying or modifying it. @return {Any} One original value, or None for an empty list. Empty and singleton lists consume no randomness. @throws {TypeError} The argument is not a List.
func Float ¶
Float draws a pseudo-random Float with zero or two numeric bounds. Ranged draws use [min, max); equal bounds return Float(min) without advancing the RNG. Non-finite bounds and unequal intervals containing no Float are invalid.
func Int ¶
int draws a non-cryptographic pseudo-random integer between inclusive bounds. @param min {Int} Inclusive lower bound; must not exceed max. Floats are not coerced. @param max {Int} Inclusive upper bound, including the maximum supported Int. @return {Int} A uniformly distributed integer in [min, max]. Equal bounds return min without drawing. @throws {TypeError} A bound is not an Int. @throws {InvalidArgument} The minimum exceeds the maximum.
func RegisterLib ¶
RegisterLib registers non-cryptographic random value generation. These functions are unsuitable for passwords, authentication tokens, or secrets. @namespace random
func Shuffle ¶
shuffle randomizes the input values using the Session's pseudo-random source. Materialization and Fisher-Yates use O(n) append/swap operations; their cost and the destination's storage depend on the source's collection backend. @param values {List} Input list, traversed once and never modified. Its factory creates the destination; values retain their identity. @return {List} A new list preserving the source's implementation family and backend configuration, containing the original values in randomized order. Empty and singleton lists consume no randomness. @throws {TypeError} The argument is not a List.
Types ¶
This section is empty.