randomseed
randomseed
randomseed(SEED)
Interfaces to the ANSI C function srand. Accepts one integer argument that is used to initialize the implementation-dependent random number generator.
Esempio 1. Esempio randomseed
randomseed(42)
local r1 = random(100)
local r2 = random(100)
print("random(100) with seed 42: " .. r1 .. ", " .. r2)
-- seed 42 gives deterministic sequence: 1, 2 on this build
assert(r1 == 1)