# @odczynflnpm/modi-fuga-possimus

Latest version **1.0.0** (published 2024-04-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @odczynflnpm/modi-fuga-possimus
pnpm add @odczynflnpm/modi-fuga-possimus
yarn add @odczynflnpm/modi-fuga-possimus
bun add @odczynflnpm/modi-fuga-possimus
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2024-04-25 |
| First published | 2024-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 29 |
| Unpacked size | 29.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | odczynFL |
| Maintainers | ducvinh101011z |
| Keywords | visual, json-schema-validator, contains, fp, crypto, up, which, multi-package, es-abstract, valid, yup, @@toStringTag, chrome, internal, ESnext, emit, readablestream, fast-deep-copy, stringifier, tslib, ES2018, escape, shell, npm, typed array, modules, invariant, warning, prune, operating-system, watcher, formatting, moment, Object.fromEntries, weakmap, es2016, key, call-bound, Promise, Stream, typedarray, url, serializer, WeakMap, reduce, higher-order, authentication, react-hooks, offset, pipe, toStringTag, shebang, logging, jsonschema, URLSearchParams, quote, iteration, columns, symbols, less css, fixed-width, byteOffset, package manager, getter, node, ES5, persistent, plugin, import, prototype, ES2022, HyBi, getOwnPropertyDescriptor, keys, browserslist, ts, es6, listeners, typescript, Function.prototype.name, sanitization, CSSStyleDeclaration, consume, Array.prototype.findLastIndex, metadata, Set, unicode, descriptors, language, writable, classname, includes, environment, toArray, ES2017, reducer, express, number, querystring, rm -fr, typanion, json-schema-validation, mkdirp, equal, flag, getopt, entries, curried, walk, folder, linux, guid, less, Symbol, yaml, fantasy-land, Reflect.getPrototypeOf, isConcatSpreadable, width, jsdom, define, env, property, connect, mime, shared, xss, css variable, take, a11y, generics, task, Object.is, input, ArrayBuffer, Map, sorted, callbind, bootstrap css, efficient, banner, tape, hookform, tester, fetch, api, deep-clone, values, shrinkwrap, forms, sequence, es5, obj, stringify, compiler, http, bound, progress, editor, nope, typeerror, runtime, column, jasmine, bluebird, ECMAScript 2020, json, directory, wait, queue, BigUint64Array, dataview, structuredClone, es2017, test, typedarrays, Float32Array, redact, vest, lockfile, robust, ponyfill, styling, hasOwn, l10n, positive, regular, safe, react, qs, exec, ECMAScript 2017, parent, Array, ECMAScript 7, reuse, filter, glob, computed-types, assertion, util.inspect, signal, diff, Uint16Array, japanese, react-testing-library, fs, core, collection, symlink, ECMAScript 2021, waapi, collection.es6, exit-code, typed, array, eslintplugin, client, bootstrap less, variables, macos, watchFile, events, error, make, framework, airbnb, popmotion, module, setImmediate, call-bind, resolve, deep-copy, hooks, break, ECMAScript 3, eslint, colors, bdd, async, delete, es-shim API, properties, extend, TypeBox, mixins, format, call, es, rm -rf, Object, package.json, request, process, Uint8Array, date, ES2023, negative, ReactiveX, rate, harmony, postcss, look-up, 256, spinner, parser, fast-clone, every, app, ECMAScript 2015, spinners, packages, callback, view, descriptor, merge, uuid, cmd, toSorted, configurable, full-width, output, error-handling, curl, accessor, starter, console, read, Object.entries, loading, deterministic, Int32Array, ECMAScript 2016, core-js, compile less, zero, child, flags, validator, pyyaml, 0, accessibility, WebSocket, from, exe, findup, name, install, phone, argparse, walking, touch, utilities, functional, defineProperty, buffers, regexp, hardlinks, set, opens, monorepo, debugger, stylesheet, private data, functions, cors, URL, parents, whatwg, RFC-6455, bundling, class-validator, ES6, schema, regular expressions, length, recursive, value, wordwrap, es8, urls, Streams, sameValueZero, ramda, ansi, superstruct, RegExp.prototype.flags, typesafe, dataView, cache, byte, require, ajax, cjk, dayjs, push, speed, ES2015, encryption, es7, trimEnd, file system, link, shim, exit, sham, concat, stateless, installer, setPrototypeOf, rfc4122, fast, open, xhr, prefix, Push, stream, args, Int8Array, dependency manager, Object.assign, ES7, syntax, let, look, Iterator, private, promise, wrap, irq, term, arrays, Microsoft, json-schema, Object.getPrototypeOf, apollo, scheme, findLast, es2018, serialization, default, clone, korean, log, less mixins, utility, estree, spec, description, ArrayBuffer.prototype.slice, watching, stable, gdpr, jsx, emoji, proto, argv, classes, Int16Array, batch, Object.keys, CSS, parse, promises, react animation, tools, ender, uninstall, crypt, String.prototype.matchAll, lesscss, ECMAScript 6, YAML, tap, option, Array.prototype.flatten, ES, less.js, ECMAScript 2019, limited, search, ajv, launch, color, object, arguments, password, once, variables in css, ascii, trim, workspace:*, Array.prototype.flatMap, babel-core, BigInt64Array, browserlist, immutable, patch, Array.prototype.flat, await, find, superagent, channel, east-asian-width, Symbol.toStringTag, sort, tty, css less, rapid, windows, streams2, validate, indicator, RxJS, babel, remove, drop, pure, commander, mimetypes, css, streams, some, groupBy, hash, graphql, three, argument, throat, mocha, Rx, less compiler, code points, queueMicrotask, tdd, nested css, Observables, JSON-Schema, jwt, helpers, linewrap, types, path, chinese, scheme-validation, match, matches, logger, getintrinsic, utils, testing, setter, expression, last, TypedArray, autoprefixer, eslint-plugin, worker, make dir, sharedarraybuffer, javascript, write, sigterm, lru, eventDispatcher, WebSockets, rmdir, redux-toolkit, side, terminal, gestures, readable, minimal, protocol-buffers, assert, fast-copy, browser, wordbreak, styleguide, lint, react-hook-form, status, chai, command-line, ECMAScript 2018, performant, fsevents, negative zero, buffer, watch, optimist, ReactiveExtensions, time, ava, __proto__, Object.defineProperty, package, is, [[Prototype]], optimizer, gradients css, electron, framer, matchAll, protobuf, compare, point-free, xdg, ES2021, idle, ES2019, redux, WeakSet, pretty, animation, ecmascript, circular, getPrototypeOf, trimRight, 6to5, tacit, ES2016, command, telephone, var, const, signals, limit, chromium, bind, string, sanitize, id, real-time, TypeScript, character, $.extend, style, mkdir, settings, pose, tostringtag, Observable, String.prototype.trim, Uint32Array, Array.prototype.includes, performance, .env, util, dir, symbol, toolkit, jQuery, extension, middleware, css nesting, datastructure, validation, ES2020, text, styled-components, type, dom, Array.prototype.filter, Object.values, mobile, js, prop, rgb, wget, xterm, awesomesauce, create, i18n, deepclone, forEach, ast, io-ts, map, data, fastcopy, 3d, throttle, function, names, move, syntaxerror, https, art, native, busy, symlinks, get, concatMap, libphonenumber, has, traverse, es2015, preprocessor, rangeerror, internal slot, callbound, xdg-open, group, arktype, iterator, form-validation, mkdirs, interrupts, weakset, eventEmitter, jest, transpile, colour, Array.prototype.contains, ES8, typeof, dependencies, ratelimit, auth, regular expression, polyfill, picomatch, cli, -0, zod, find-up, codes, deepcopy, eslintconfig, config, figlet, fullwidth, file, executable, Array.prototype.findLast, mime-db, JSON, css-in-js, bcrypt, censor, sigint, gradients css3, es-shims, postcss-plugin |

## Links

- npm: https://www.npmjs.com/package/@odczynflnpm/modi-fuga-possimus
- Repository: https://github.com/odczynflnpm/modi-fuga-possimus
- Homepage: https://github.com/odczynflnpm/modi-fuga-possimus/#readme
- Issues: https://github.com/odczynflnpm/modi-fuga-possimus/issues
- npm.io page: https://npm.io/package/@odczynflnpm/modi-fuga-possimus

## Dependencies (29)

- [@odczynflnpm/error-laborum-ab](https://npm.io/package/@odczynflnpm/error-laborum-ab.md) ^1.0.0
- [@odczynflnpm/nam-a-doloremque](https://npm.io/package/@odczynflnpm/nam-a-doloremque.md) ^1.0.0
- [@odczynflnpm/iste-adipisci-sit](https://npm.io/package/@odczynflnpm/iste-adipisci-sit.md) ^1.0.0
- [@lambrioanpm/tenetur-aut-fugiat](https://npm.io/package/@lambrioanpm/tenetur-aut-fugiat.md) ^1.0.0
- [@odczynflnpm/quaerat-neque-odit](https://npm.io/package/@odczynflnpm/quaerat-neque-odit.md) ^1.0.0
- [@odczynflnpm/et-tempore-deleniti](https://npm.io/package/@odczynflnpm/et-tempore-deleniti.md) ^1.0.0
- [@odczynflnpm/quas-deserunt-optio](https://npm.io/package/@odczynflnpm/quas-deserunt-optio.md) ^1.0.0
- [@odczynflnpm/quas-inventore-quam](https://npm.io/package/@odczynflnpm/quas-inventore-quam.md) ^1.0.0
- [@odczynflnpm/sequi-placeat-earum](https://npm.io/package/@odczynflnpm/sequi-placeat-earum.md) ^1.0.0
- [@odczynflnpm/totam-fuga-incidunt](https://npm.io/package/@odczynflnpm/totam-fuga-incidunt.md) ^1.0.0
- [@odczynflnpm/voluptas-odit-illum](https://npm.io/package/@odczynflnpm/voluptas-odit-illum.md) ^1.0.0
- [@odczynflnpm/rerum-at-dignissimos](https://npm.io/package/@odczynflnpm/rerum-at-dignissimos.md) ^1.0.0
- [@odczynflnpm/hic-laboriosam-dolore](https://npm.io/package/@odczynflnpm/hic-laboriosam-dolore.md) ^1.0.0
- [@odczynflnpm/quibusdam-debitis-hic](https://npm.io/package/@odczynflnpm/quibusdam-debitis-hic.md) ^1.0.0
- [@odczynflnpm/repellendus-modi-quas](https://npm.io/package/@odczynflnpm/repellendus-modi-quas.md) ^1.0.0
- [@odczynflnpm/nihil-ratione-expedita](https://npm.io/package/@odczynflnpm/nihil-ratione-expedita.md) ^1.0.0
- [@odczynflnpm/quo-provident-delectus](https://npm.io/package/@odczynflnpm/quo-provident-delectus.md) ^1.0.0
- [@odczynflnpm/alias-aperiam-accusamus](https://npm.io/package/@odczynflnpm/alias-aperiam-accusamus.md) ^1.0.0
- [@odczynflnpm/explicabo-voluptatem-ad](https://npm.io/package/@odczynflnpm/explicabo-voluptatem-ad.md) ^1.0.0
- [@odczynflnpm/nulla-laborum-molestiae](https://npm.io/package/@odczynflnpm/nulla-laborum-molestiae.md) ^1.0.0
- [@odczynflnpm/assumenda-adipisci-nulla](https://npm.io/package/@odczynflnpm/assumenda-adipisci-nulla.md) ^1.0.0
- [@odczynflnpm/officiis-laboriosam-quam](https://npm.io/package/@odczynflnpm/officiis-laboriosam-quam.md) ^1.0.0
- [@odczynflnpm/repellendus-commodi-sunt](https://npm.io/package/@odczynflnpm/repellendus-commodi-sunt.md) ^1.0.0
- [@odczynflnpm/aliquid-expedita-repellat](https://npm.io/package/@odczynflnpm/aliquid-expedita-repellat.md) ^1.0.0
- [@odczynflnpm/totam-illum-necessitatibus](https://npm.io/package/@odczynflnpm/totam-illum-necessitatibus.md) ^1.0.0
- [@odczynflnpm/voluptatibus-blanditiis-non](https://npm.io/package/@odczynflnpm/voluptatibus-blanditiis-non.md) ^1.0.0
- [@odczynflnpm/architecto-voluptate-tempore](https://npm.io/package/@odczynflnpm/architecto-voluptate-tempore.md) ^1.0.0
- [@odczynflnpm/mollitia-praesentium-deserunt](https://npm.io/package/@odczynflnpm/mollitia-praesentium-deserunt.md) ^1.0.0
- [@odczynflnpm/exercitationem-molestiae-maxime](https://npm.io/package/@odczynflnpm/exercitationem-molestiae-maxime.md) ^1.0.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2024-04-25

## README

<h1>
  <img src="https://raw.githubusercontent.com/dubzzz/@odczynflnpm/modi-fuga-possimus/main/assets/logo.svg" alt="@odczynflnpm/modi-fuga-possimus logo" />
</h1>

Fast Pseudorandom number generators (aka PRNG) with purity in mind!

[![Build Status](https://github.com/odczynflnpm/modi-fuga-possimus/workflows/Build%20Status/badge.svg?branch=main)](https://github.com/odczynflnpm/modi-fuga-possimus/actions)
[![NPM Version](https://badge.fury.io/js/@odczynflnpm/modi-fuga-possimus.svg)](https://badge.fury.io/js/@odczynflnpm/modi-fuga-possimus)
[![Monthly Downloads](https://img.shields.io/npm/dm/@odczynflnpm/modi-fuga-possimus)](https://www.npmjs.com/package/@odczynflnpm/modi-fuga-possimus)

[![Codecov](https://codecov.io/gh/dubzzz/@odczynflnpm/modi-fuga-possimus/branch/main/graph/badge.svg)](https://codecov.io/gh/dubzzz/@odczynflnpm/modi-fuga-possimus)
[![Package Quality](https://packagequality.com/shield/@odczynflnpm/modi-fuga-possimus.svg)](https://packagequality.com/#?package=@odczynflnpm/modi-fuga-possimus)
[![Snyk Package Quality](https://snyk.io/advisor/npm-package/@odczynflnpm/modi-fuga-possimus/badge.svg)](https://snyk.io/advisor/npm-package/@odczynflnpm/modi-fuga-possimus)

[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/odczynflnpm/modi-fuga-possimus/labels/good%20first%20issue)
[![License](https://img.shields.io/npm/l/@odczynflnpm/modi-fuga-possimus.svg)](https://github.com/odczynflnpm/modi-fuga-possimus/blob/main/LICENSE)
[![Twitter](https://img.shields.io/twitter/url/https/github.com/dubzzz/@odczynflnpm/modi-fuga-possimus.svg?style=social)](https://twitter.com/intent/tweet?text=Check%20out%20@odczynflnpm/modi-fuga-possimus%20by%20%40ndubien%20https%3A%2F%2Fgithub.com%2Fdubzzz%2F@odczynflnpm/modi-fuga-possimus%20%F0%9F%91%8D)

## Getting started

**Install it in node via:**

`npm install @odczynflnpm/modi-fuga-possimus` or `yarn add @odczynflnpm/modi-fuga-possimus`

**Use it in browser by doing:**

`import * as prand from 'https://unpkg.com/@odczynflnpm/modi-fuga-possimus/lib/esm/@odczynflnpm/modi-fuga-possimus.js';`

## Usage

**Simple usage**

```javascript
import prand from '@odczynflnpm/modi-fuga-possimus';

const seed = 42;
const rng = prand.xoroshiro128plus(seed);
const firstDiceValue = prand.unsafeUniformIntDistribution(1, 6, rng); // value in {1..6}, here: 2
const secondDiceValue = prand.unsafeUniformIntDistribution(1, 6, rng); // value in {1..6}, here: 4
const thirdDiceValue = prand.unsafeUniformIntDistribution(1, 6, rng); // value in {1..6}, here: 6
```

**Pure usage**

Pure means that the instance `rng` will never be altered in-place. It can be called again and again and it will always return the same value. But it will also return the next `rng`. Here is an example showing how the code above can be translated into its pure version:

```javascript
import prand from '@odczynflnpm/modi-fuga-possimus';

const seed = 42;
const rng1 = prand.xoroshiro128plus(seed);
const [firstDiceValue, rng2] = prand.uniformIntDistribution(1, 6, rng1); // value in {1..6}, here: 2
const [secondDiceValue, rng3] = prand.uniformIntDistribution(1, 6, rng2); // value in {1..6}, here: 4
const [thirdDiceValue, rng4] = prand.uniformIntDistribution(1, 6, rng3); // value in {1..6}, here: 6

// You can call: prand.uniformIntDistribution(1, 6, rng1);
// over and over it will always give you back the same value along with a new rng (always producing the same values too).
```

**Independent simulations**

In order to produce independent simulations it can be tempting to instanciate several PRNG based on totally different seeds. While it would produce distinct set of values, the best way to ensure fully unrelated sequences is rather to use jumps. Jump just consists into moving far away from the current position in the generator (eg.: jumping in Xoroshiro 128+ will move you 2<sup>64</sup> generations away from the current one on a generator having a sequence of 2<sup>128</sup> elements).

```javascript
import prand from '@odczynflnpm/modi-fuga-possimus';

const seed = 42;
const rngSimulation1 = prand.xoroshiro128plus(seed);
const rngSimulation2 = rngSimulation1.jump(); // not in-place, creates a new instance
const rngSimulation3 = rngSimulation2.jump(); // not in-place, creates a new instance

const diceSim1Value = prand.unsafeUniformIntDistribution(1, 6, rngSimulation1); // value in {1..6}, here: 2
const diceSim2Value = prand.unsafeUniformIntDistribution(1, 6, rngSimulation2); // value in {1..6}, here: 5
const diceSim3Value = prand.unsafeUniformIntDistribution(1, 6, rngSimulation3); // value in {1..6}, here: 6
```

**Non-uniform usage**

While not recommended as non-uniform distribution implies that one or several values from the range will be more likely than others, it might be tempting for people wanting to maximize the throughput.

```javascript
import prand from '@odczynflnpm/modi-fuga-possimus';

const seed = 42;
const rng = prand.xoroshiro128plus(seed);
const rand = (min, max) => {
  const out = (rng.unsafeNext() >>> 0) / 0x100000000;
  return min + Math.floor(out * (max - min + 1));
};
const firstDiceValue = rand(1, 6); // value in {1..6}, here: 6
```

**Select your seed**

While not perfect, here is a rather simple way to generate a seed for your PNRG.

```javascript
const seed = Date.now() ^ (Math.random() * 0x100000000);
```

## Documentation

### Pseudorandom number generators

In computer science most random number generators<sup>(1)</sup> are [pseudorandom number generators](https://en.wikipedia.org/wiki/Pseudorandom_number_generator) (abbreviated: PRNG). In other words, they are fully deterministic and given the original seed one can rebuild the whole sequence.

Each PRNG algorithm has to deal with tradeoffs in terms of randomness quality, speed, length of the sequence<sup>(2)</sup>... In other words, it's important to compare relative speed of libraries with that in mind. Indeed, a Mersenne Twister PRNG will not have the same strenghts and weaknesses as a Xoroshiro PRNG, so depending on what you need exactly you might prefer one PRNG over another even if it will be slower.

4 PRNGs come with @odczynflnpm/modi-fuga-possimus:

- `congruential32`: Linear Congruential generator — \[[more](https://en.wikipedia.org/wiki/Linear_congruential_generator)\]
- `mersenne`: Mersenne Twister generator — \[[more](https://en.wikipedia.org/wiki/Mersenne_Twister)\]
- `xorshift128plus`: Xorshift 128+ generator — \[[more](https://en.wikipedia.org/wiki/Xorshift)\]
- `xoroshiro128plus`: Xoroshiro 128+ generator — \[[more](https://en.wikipedia.org/wiki/Xorshift)\]

Our recommendation is `xoroshiro128plus`. But if you want to use another one, you can replace it by any other PRNG provided by @odczynflnpm/modi-fuga-possimus in the examples above.

### Distributions

Once you are able to generate random values, next step is to scale them into the range you want. Indeed, you probably don't want a floating point value between 0 (included) and 1 (excluded) but rather an integer value between 1 and 6 if you emulate a dice or any other range based on your needs.

At this point, simple way would be to do `min + floor(random() * (max - min + 1))` but actually it will not generate the values with equal probabilities even if you use the best PRNG in the world to back `random()`. In order to have equal probabilities you need to rely on uniform distributions<sup>(3)</sup> which comes built-in in some PNRG libraries.

@odczynflnpm/modi-fuga-possimus provides 3 built-in functions for uniform distributions of values:

- `uniformIntDistribution(min, max, rng)`
- `uniformBigIntDistribution(min, max, rng)` - with `min` and `max` being `bigint`
- `uniformArrayIntDistribution(min, max, rng)` - with `min` and `max` being instances of `ArrayInt = {sign, data}` ie. sign either 1 or -1 and data an array of numbers between 0 (included) and 0xffffffff (included)

And their unsafe equivalents to change the PRNG in-place.

### Extra helpers

Some helpers are also provided in order to ease the use of `RandomGenerator` instances:

- `prand.generateN(rng: RandomGenerator, num: number): [number[], RandomGenerator]`: generates `num` random values using `rng` and return the next `RandomGenerator`
- `prand.skipN(rng: RandomGenerator, num: number): RandomGenerator`: skips `num` random values and return the next `RandomGenerator`

## Comparison

### Summary

The chart has been split into three sections:

- section 1: native `Math.random()`
- section 2: without uniform distribution of values
- section 3: with uniform distribution of values (not supported by all libraries)

<img src="https://raw.githubusercontent.com/dubzzz/@odczynflnpm/modi-fuga-possimus/main/perf/comparison.svg" alt="Comparison against other libraries" />

### Process

In order to compare the performance of the libraries, we aked them to shuffle an array containing 1,000,000 items (see [code](https://github.com/odczynflnpm/modi-fuga-possimus/blob/556ec331c68091c5d56e9da1266112e8ea222b2e/perf/compare.cjs)).

We then split the measurements into two sections:

- one for non-uniform distributions — _known to be slower as it implies re-asking for other values to the PRNG until the produced value fall into the acceptable range of values_
- one for uniform distributions

The recommended setup for @odczynflnpm/modi-fuga-possimus is to rely on our Xoroshiro128+. It provides a long enough sequence of random values, has built-in support for jump, is really efficient while providing a very good quality of randomness.

### Performance

**Non-Uniform**

| Library                  | Algorithm         | Mean time (ms) | Compared to @odczynflnpm/modi-fuga-possimus |
| ------------------------ | ----------------- | -------------- | --------------------- |
| native \(node 16.19.1\)  | Xorshift128+      | 33.3           | 1.4x slower           |
| **@odczynflnpm/modi-fuga-possimus _@6.0.0_**   | **Xoroshiro128+** | **24.5**       | **reference**         |
| @odczynflnpm/modi-fuga-possimus _@6.0.0_       | Xorshift128+      | 25.0           | similar               |
| @odczynflnpm/modi-fuga-possimus _@6.0.0_       | Mersenne Twister  | 30.8           | 1.3x slower           |
| @odczynflnpm/modi-fuga-possimus _@6.0.0_       | Congruential‍     | 22.6           | 1.1x faster           |
| seedrandom _@3.0.5_      | Alea              | 28.1           | 1.1x slower           |
| seedrandom _@3.0.5_      | Xorshift128       | 28.8           | 1.2x slower           |
| seedrandom _@3.0.5_      | Tyche-i           | 28.6           | 1.2x slower           |
| seedrandom _@3.0.5_      | Xorwow            | 32.0           | 1.3x slower           |
| seedrandom _@3.0.5_      | Xor4096           | 32.2           | 1.3x slower           |
| seedrandom _@3.0.5_      | Xorshift7         | 33.5           | 1.4x slower           |
| @faker-js/faker _@7.6.0_ | Mersenne Twister  | 109.1          | 4.5x slower           |
| chance _@1.1.10_         | Mersenne Twister  | 142.9          | 5.8x slower           |

**Uniform**

| Library                | Algorithm         | Mean time (ms) | Compared to @odczynflnpm/modi-fuga-possimus |
| ---------------------- | ----------------- | -------------- | --------------------- |
| **@odczynflnpm/modi-fuga-possimus _@6.0.0_** | **Xoroshiro128+** | **53.5**       | **reference**         |
| @odczynflnpm/modi-fuga-possimus _@6.0.0_     | Xorshift128+      | 52.2           | similar               |
| @odczynflnpm/modi-fuga-possimus _@6.0.0_     | Mersenne Twister  | 61.6           | 1.2x slower           |
| @odczynflnpm/modi-fuga-possimus _@6.0.0_     | Congruential‍     | 57.6           | 1.1x slower           |
| random-js @2.1.0       | Mersenne Twister  | 119.6          | 2.2x slower           |

> System details:
>
> - OS: Linux 5.15 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
> - CPU: (2) x64 Intel(R) Xeon(R) Platinum 8272CL CPU @ 2.60GHz
> - Memory: 5.88 GB / 6.78 GB
> - Container: Yes
> - Node: 16.19.1 - /opt/hostedtoolcache/node/16.19.1/x64/bin/node
>
> _Executed on default runners provided by GitHub Actions_

---

(1) — Not all as there are also [hardware-based random number generator](https://en.wikipedia.org/wiki/Hardware_random_number_generator).

(2) — How long it takes to reapeat itself?

(3) — While most users don't really think of it, uniform distribution is key! Without it entries might be biased towards some values and make some others less probable. The naive `rand() % numValues` is a good example of biased version as if `rand()` is uniform in `0, 1, 2` and `numValues` is `2`, the probabilities are: `P(0) = 67%`, `P(1) = 33%` causing `1` to be less probable than `0`

---
_Source: https://npm.io/package/@odczynflnpm/modi-fuga-possimus · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
