Try the generator
The same seed gives the same numbers each time, in Node and in each browser. Type a seed, or a label for a named stream, and the page draws again.
draws in each binexpected count
Packages
| Package | State | What it gives |
|---|---|---|
@mark1russell7/rigor-generators | 0.1.0 | A seeded generator and its draws: integers, picks, weights, shuffles, samples, normal values and named streams. Next: input families, stratified and Latin hypercube designs, Saltelli designs, shrinking. |
@mark1russell7/rigor-statistics | 0.1.0 | Quantiles, bootstrap intervals (also of clusters), the sign test, the paired permutation test, Wilson intervals, the Holm correction, rank correlation, the comparison with a baseline beyond the noise (the 5-seed rule), and Brier scores. Next: Sobol indices. |
rigor-gates | planned | The determinism gate (one input gives one hash), the promotion test and the performance evidence of a release. |
rigor-testgen | planned | Property tests on fast-check, pairwise and covering arrays, and metamorphic relations. |
rigor-chaos | planned | Fault injection, schedules of latency and failure, and load profiles, with their measures. |
Why
The duplication atlas (codeatlas) found the same seeded generator written by hand approximately 40 times, in more than 10 repositories. No repository imported it from a package. The copies use different forms of mulberry32, but each one gives the same numbers as random(seed).next. Thus a repository moves to the package with no change to its records, and its tests prove it.
npm install @mark1russell7/rigor-generators
import { random, seedsFrom } from "@mark1russell7/rigor-generators";
for (const seed of seedsFrom(process.env.SEED, [1, 2, 3, 4, 5])) {
const r = random(seed);
const lanes = r.fork("lanes"); // an independent stream for one part of the work
const n = r.int(10, 1000); // 10 to 1000, both included
const order = lanes.shuffle(items); // a new list in a random order
}