function
jsc.setRandomSeed
value: number
): void;
Reseeds the pseudo-random number generator behind Math.random(), making the values it returns reproducible: after setting the same seed, Math.random() returns the same sequence of values.
The generator belongs to the current global object, so this does not affect node:vm contexts, and it has no effect on node:crypto or Web Crypto.
@param value
The seed, converted to an unsigned 32-bit integer
import { setRandomSeed } from "bun:jsc";
setRandomSeed(42);
const a = Math.random();
setRandomSeed(42);
Math.random() === a; // true