Tane documentation
Tane 種 — Seeded random numbers for JavaScript
Reproduce numbers from a seed, shuffle or pick items, share a daily puzzle and resume a saved stream.
Install
npm install @johnmorrisdotca/tane
Start here
Entry points
| Import it | What it is | Size |
|---|---|---|
@johnmorrisdotca/React hooks · 3 exports | 10.5 kB | |
@johnmorrisdotca/Picker element · 7 exports | 4.3 kB | |
@johnmorrisdotca/Register the picker · 7 exports | 4.3 kB | |
@johnmorrisdotca/Streams, draws and seeds · 64 exports | Tane 種: seeded random numbers and daily seeds. | 9.8 kB |
Guides
How-to
- Shuffle, pick and weight choicesShuffle, pick, sample and weight with the right function, and keep draws predictable.
- Keep features on separate streamsGive each feature its own sequence so adding one never changes another.
- Make a daily puzzleMake a daily puzzle from a calendar day in UTC or a chosen time zone, and map seeds back to dates.
- Save and resume a streamCount draws, save a position as JSON, text or CSV, and resume from it.
- Embed a picker and use hooksPut the picker element on a page, decide what a shared link reveals, and use the React hooks.
Explanation
- Engine and compatibilitySee the small state of the generator, why the sequence is part of the contract, and what it is not for.
- Seed normalization and reserved rangesNormalise seeds, tell a sequence seed from a distributable one, and reserve blocks.