Dependency-free TypeScript implementation with comparison tests of popular pseudo random number generators.
Original JavaScript implementations were taken from https://github.com/bryc/code/blob/master/jshash/PRNGs.md.
npm install pseudo-random-number-generators-ts
- Mulberry32
- sfc32
- SplitMix32
- Xoshiro128ss
- MurmurHash3 variant (xmur3)
// get a random number between "from" and "to" including this range
random(from = 0, to = 1)
// get a normally distributed random number using the mean value (m) and the standard deviation (sd)
gauss(m = 0, sd = 1)