Skip to main content

Module math_random

Module math_random 

Source
Expand description

Node: cxx:Function:Luau.VM:VM/src/lmathlib.cpp:234:math_random

math.random — 0 args: a double in [0,1) from two PCG32 draws via ldexp (here * 2^-64); 1 arg u: integer in [1,u]; 2 args l,u: integer in [l,u]. Bounds use the high 32 bits of a 64-bit multiply (Lemire-style) to avoid modulo bias. Argument checks mirror the C++ exactly.

Functions§

math_random