The random library

The random library provides functions for generating random numbers.

Fields

default: native

Free Functions

new(seed: number ⁠ null): Random

Returns a new Random object. If the seed is null, a seed based on the current system time is used. Otherwise, the provided seed is used.

Member functions

next(self): number

Generates a random double value in the range [0, 1.0).

nextInt(self, bound: number): number

Generates a random integer value between 0 (inclusive) and the specified bound (exclusive).

nextRange(self, min: number, max: number): number

Generates a random integer value between the specified min (inclusive) and max (exclusive).