4.0.0 • Published 3 years ago

@entropy-source/pseudo-random v4.0.0

Weekly downloads
-
License
AGPL-3.0
Repository
github
Last release
3 years ago

:game_die: @entropy-source/pseudo-random

Pseudorandom number generators for JavaScript. See docs.

:warning: The code requires regeneratorRuntime to be defined, for instance by importing regenerator-runtime/runtime.

import {
  splitmix64,
  nextFloat64,
  nextUint64,
} from '@entropy-source/pseudo-random';

const seed = 0, 0; // Two 32-bit signed integers. const prng = splitmix64(seed); nextUint64(prng); // 64 random bits as two 32-bit signed integers (compatible with @arithmetic-type/uint64). nextFloat64(prng); // A random double in the range [0, 1[.

[![License](https://img.shields.io/github/license/entropy-source/pseudo-random.svg)](https://raw.githubusercontent.com/entropy-source/pseudo-random/main/LICENSE)
[![Version](https://img.shields.io/npm/v/@entropy-source/pseudo-random.svg)](https://www.npmjs.org/package/@entropy-source/pseudo-random)
[![Tests](https://img.shields.io/github/workflow/status/entropy-source/pseudo-random/ci:test?event=push&label=tests)](https://github.com/entropy-source/pseudo-random/actions/workflows/ci:test.yml?query=branch:main)
[![Dependencies](https://img.shields.io/david/entropy-source/pseudo-random.svg)](https://david-dm.org/entropy-source/pseudo-random)
[![Dev dependencies](https://img.shields.io/david/dev/entropy-source/pseudo-random.svg)](https://david-dm.org/entropy-source/pseudo-random?type=dev)
[![GitHub issues](https://img.shields.io/github/issues/entropy-source/pseudo-random.svg)](https://github.com/entropy-source/pseudo-random/issues)
[![Downloads](https://img.shields.io/npm/dm/@entropy-source/pseudo-random.svg)](https://www.npmjs.org/package/@entropy-source/pseudo-random)

[![Code issues](https://img.shields.io/codeclimate/issues/entropy-source/pseudo-random.svg)](https://codeclimate.com/github/entropy-source/pseudo-random/issues)
[![Code maintainability](https://img.shields.io/codeclimate/maintainability/entropy-source/pseudo-random.svg)](https://codeclimate.com/github/entropy-source/pseudo-random/trends/churn)
[![Code coverage (cov)](https://img.shields.io/codecov/c/gh/entropy-source/pseudo-random/main.svg)](https://codecov.io/gh/entropy-source/pseudo-random)
[![Code technical debt](https://img.shields.io/codeclimate/tech-debt/entropy-source/pseudo-random.svg)](https://codeclimate.com/github/entropy-source/pseudo-random/trends/technical_debt)
[![Documentation](https://entropy-source.github.io/pseudo-random/badge.svg)](https://entropy-source.github.io/pseudo-random/source.html)
[![Package size](https://img.shields.io/bundlephobia/minzip/@entropy-source/pseudo-random)](https://bundlephobia.com/result?p=@entropy-source/pseudo-random)

## :scroll: References

  - [The Art of Computer Programming Volume 2: Seminumerical Algorithms](https://en.wikipedia.org/wiki/The_Art_of_Computer_Programming#Volume_2_%E2%80%93_Seminumerical_Algorithms)
  - [The PRNG shootout](http://prng.di.unimi.it)
  - [Testing common random-number generators](https://github.com/lemire/testingRNG)