Utilities · zero-dependency · MIT

larzrandom

A small seeded pseudo-random generator - deterministic on purpose.

A real Park-Miller linear congruential generator: seed it once, get the exact same sequence every run, exact in double precision. NOT cryptographic - never use it for tokens/secrets (see apikey/crypto for that). randint/random/choice/shuffle/sample cover the everyday cases.

larzscript pkg install random
View on GitHub →Learn the stack

What you get

Try it

import "random" as rng
rng.seed(42)
print(rng.randint(1, 6), rng.random(), rng.choice(["a", "b", "c"]))
print(rng.shuffle([1,2,3,4,5]))
Output
1 0.524587 c
[5, 2, 1, 3, 4]

Why it's in the Larz Stack

larzrandom is a real Larzscript package (larzscript pkg install random) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.