pota/use/random

Small randomness helpers backed by crypto.getRandomValues — not Math.random — plus a seeded LCG (randomSeeded) for reproducibility.

random() is the module's base generator: a crypto-strength float in [0, 1). The others draw on the same crypto source; chance and randomBetween also accept a custom generator so you can swap in a seeded one for deterministic runs.

Exports

Arguments

random() takes no arguments.

Returns: a number in [0, 1), read from crypto.getRandomValues.

Examples

A random float

Reads one 32-bit value from crypto and scales it into [0, 1).

import { random } from 'pota/use/random'

random() // crypto-strength float in [0, 1)