(...seed: unknown[]): RandomAlea import {create_random_alea} from '@fuzdev/fuz_util/random_alea.js'; Seeded pseudo-random number generator. DO NOT USE when security matters, use webcrypto APIs instead.
seed
unknown[]returns
RandomAlea Alea: a seedable pseudo-random number generator by Johannes Baagøe.
Supports variadic and string seeds (create_random_alea('my', 3, 'seeds')).
For numeric seeds, prefer create_random_xoshiro which is faster with equal quality.
DO NOT USE when security matters — use the Web Crypto API (crypto.getRandomValues) instead.
Alea passes all 11 distribution quality tests at 10M samples,
performing on par with Math.random (V8's xorshift128+):
Speed is ~19% slower than Math.random (~12.2M ops/sec vs ~15.0M ops/sec).
To reproduce:
npm run benchmark_random_quality # distribution tests (N=1M)
npm run benchmark_random_quality -- --deep # thorough (N=10M, multi-trial)
npm run benchmark_random # speed comparison@see https://github.com/nquinlan/better-random-numbers-for-javascript-mirror
2 declarations
(...seed: unknown[]): RandomAlea import {create_random_alea} from '@fuzdev/fuz_util/random_alea.js'; Seeded pseudo-random number generator. DO NOT USE when security matters, use webcrypto APIs instead.
seedunknown[]RandomAlea RandomAlea import type {RandomAlea} from '@fuzdev/fuz_util/random_alea.js'; uint32type () => number
fract53type () => number
versiontype string
seedstype Array<unknown>
(call)type (): number
number