{
"id": "fn-srand",
"dataComponent": "math",
"heading": {
"title": "srand",
"badges": [
"Random",
"Seed"
]
},
"synopsis": "Creates a seeded pseudo-random number generator function from the given integer seed",
"codeBlocks": [
"extend(\"math\")\n\ngen = math:srand(42)\nsput( gen() ) // => e.g. 1608638478\nsput( gen() ) // => next number from seed=42"
],
"notes": [
"Pass an integer seed to srand, which returns a new generator function.",
"Each call to the generator produces a next pseudo-random integer based on that seed.",
"The sequence is deterministic, so the same seed yields the same sequence every time."
]
}