Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/stdlib-js/random-iter

Standard library pseudorandom number generator iterators.
https://github.com/stdlib-js/random-iter

generator javascript lib library math mathematics node node-js nodejs prng pseudorandom rand random rng seed seedable standard statistics stats stdlib

Last synced: 4 days ago
JSON representation

Standard library pseudorandom number generator iterators.

Awesome Lists containing this project

README

        


About stdlib...

We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.


The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.


When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.


To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!

# Pseudorandom Number Generator Iterators

[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url]

> Pseudorandom number generator (PRNG) iterators.

## Installation

```bash
npm install @stdlib/random-iter
```

Alternatively,

- To load the package in a website via a `script` tag without installation and bundlers, use the [ES Module][es-module] available on the [`esm`][esm-url] branch (see [README][esm-readme]).
- If you are using Deno, visit the [`deno`][deno-url] branch (see [README][deno-readme] for usage intructions).
- For use in Observable, or in browser/node environments, use the [Universal Module Definition (UMD)][umd] build available on the [`umd`][umd-url] branch (see [README][umd-readme]).

The [branches.md][branches-url] file summarizes the available branches and displays a diagram illustrating their relationships.

To view installation and usage instructions specific to each branch build, be sure to explicitly navigate to the respective README files on each branch, as linked to above.

## Usage

```javascript
var ns = require( '@stdlib/random-iter' );
```

#### ns

Namespace containing pseudorandom number generator (PRNG) iterators.

```javascript
var iterators = ns;
// returns {...}
```

The namespace contains the following functions for creating iterator protocol-compliant iterators:

- [`arcsine( a, b[, options] )`][@stdlib/random/iter/arcsine]: create an iterator for generating pseudorandom numbers drawn from an arcsine distribution.
- [`bernoulli( p[, options] )`][@stdlib/random/iter/bernoulli]: create an iterator for generating pseudorandom numbers drawn from a Bernoulli distribution.
- [`beta( alpha, beta[, options] )`][@stdlib/random/iter/beta]: create an iterator for generating pseudorandom numbers drawn from a beta distribution.
- [`betaprime( alpha, beta[, options] )`][@stdlib/random/iter/betaprime]: create an iterator for generating pseudorandom numbers drawn from a beta prime distribution.
- [`binomial( n, p[, options] )`][@stdlib/random/iter/binomial]: create an iterator for generating pseudorandom numbers drawn from a binomial distribution.
- [`boxMuller( [options] )`][@stdlib/random/iter/box-muller]: create an iterator for generating pseudorandom numbers drawn from a standard normal distribution using the Box-Muller transform.
- [`cauchy( x0, gamma[, options] )`][@stdlib/random/iter/cauchy]: create an iterator for generating pseudorandom numbers drawn from a Cauchy distribution.
- [`chi( k[, options] )`][@stdlib/random/iter/chi]: create an iterator for generating pseudorandom numbers drawn from a chi distribution.
- [`chisquare( k[, options] )`][@stdlib/random/iter/chisquare]: create an iterator for generating pseudorandom numbers drawn from a chi-square distribution.
- [`cosine( mu, s[, options] )`][@stdlib/random/iter/cosine]: create an iterator for generating pseudorandom numbers drawn from a raised cosine distribution.
- [`discreteUniform( a, b[, options] )`][@stdlib/random/iter/discrete-uniform]: create an iterator for generating pseudorandom numbers drawn from a discrete uniform distribution.
- [`erlang( k, lambda[, options] )`][@stdlib/random/iter/erlang]: create an iterator for generating pseudorandom numbers drawn from an Erlang distribution.
- [`exponential( lambda[, options] )`][@stdlib/random/iter/exponential]: create an iterator for generating pseudorandom numbers drawn from an exponential distribution.
- [`f( d1, d2[, options] )`][@stdlib/random/iter/f]: create an iterator for generating pseudorandom numbers drawn from an F distribution.
- [`frechet( alpha, s, m[, options] )`][@stdlib/random/iter/frechet]: create an iterator for generating pseudorandom numbers drawn from a Fréchet distribution.
- [`gamma( alpha, beta[, options] )`][@stdlib/random/iter/gamma]: create an iterator for generating pseudorandom numbers drawn from a gamma distribution.
- [`geometric( p[, options] )`][@stdlib/random/iter/geometric]: create an iterator for generating pseudorandom numbers drawn from a geometric distribution.
- [`gumbel( mu, beta[, options] )`][@stdlib/random/iter/gumbel]: create an iterator for generating pseudorandom numbers drawn from a Gumbel distribution.
- [`hypergeometric( N, K, n[, options] )`][@stdlib/random/iter/hypergeometric]: create an iterator for generating pseudorandom numbers drawn from a hypergeometric distribution.
- [`improvedZiggurat( [options] )`][@stdlib/random/iter/improved-ziggurat]: create an iterator for generating pseudorandom numbers drawn from a standard normal distribution using the Improved Ziggurat algorithm.
- [`invgamma( alpha, beta[, options] )`][@stdlib/random/iter/invgamma]: create an iterator for generating pseudorandom numbers drawn from an inverse gamma distribution.
- [`kumaraswamy( a, b[, options] )`][@stdlib/random/iter/kumaraswamy]: create an iterator for generating pseudorandom numbers drawn from a Kumaraswamy's double bounded distribution.
- [`laplace( mu, b[, options] )`][@stdlib/random/iter/laplace]: create an iterator for generating pseudorandom numbers drawn from a Laplace (double exponential) distribution.
- [`levy( mu, c[, options] )`][@stdlib/random/iter/levy]: create an iterator for generating pseudorandom numbers drawn from a Lévy distribution.
- [`logistic( mu, s[, options] )`][@stdlib/random/iter/logistic]: create an iterator for generating pseudorandom numbers drawn from a logistic distribution.
- [`lognormal( mu, sigma[, options] )`][@stdlib/random/iter/lognormal]: create an iterator for generating pseudorandom numbers drawn from a lognormal distribution.
- [`minstdShuffle( [options] )`][@stdlib/random/iter/minstd-shuffle]: create an iterator for a linear congruential pseudorandom number generator (LCG) whose output is shuffled.
- [`minstd( [options] )`][@stdlib/random/iter/minstd]: create an iterator for a linear congruential pseudorandom number generator (LCG) based on Park and Miller.
- [`mt19937( [options] )`][@stdlib/random/iter/mt19937]: create an iterator for a 32-bit Mersenne Twister pseudorandom number generator.
- [`negativeBinomial( r, p[, options] )`][@stdlib/random/iter/negative-binomial]: create an iterator for generating pseudorandom numbers drawn from a negative binomial distribution.
- [`normal( mu, sigma[, options] )`][@stdlib/random/iter/normal]: create an iterator for generating pseudorandom numbers drawn from a normal distribution.
- [`pareto1( alpha, beta[, options] )`][@stdlib/random/iter/pareto-type1]: create an iterator for generating pseudorandom numbers drawn from a Pareto (Type I) distribution.
- [`poisson( lambda[, options] )`][@stdlib/random/iter/poisson]: create an iterator for generating pseudorandom numbers drawn from a Poisson distribution.
- [`randi( [options] )`][@stdlib/random/iter/randi]: create an iterator for generating pseudorandom numbers having integer values.
- [`randn( [options] )`][@stdlib/random/iter/randn]: create an iterator for generating pseudorandom numbers drawn from a standard normal distribution.
- [`randu( [options] )`][@stdlib/random/iter/randu]: create an iterator for generating uniformly distributed pseudorandom numbers between `0` and `1`.
- [`rayleigh( sigma[, options] )`][@stdlib/random/iter/rayleigh]: create an iterator for generating pseudorandom numbers drawn from a Rayleigh distribution.
- [`t( v[, options] )`][@stdlib/random/iter/t]: create an iterator for generating pseudorandom numbers drawn from a Student's t distribution.
- [`triangular( a, b, c[, options] )`][@stdlib/random/iter/triangular]: create an iterator for generating pseudorandom numbers drawn from a triangular distribution.
- [`uniform( a, b[, options] )`][@stdlib/random/iter/uniform]: create an iterator for generating pseudorandom numbers drawn from a continuous uniform distribution.
- [`weibull( k, lambda[, options] )`][@stdlib/random/iter/weibull]: create an iterator for generating pseudorandom numbers drawn from a Weibull distribution.

## Examples

```javascript
var objectKeys = require( '@stdlib/utils-keys' );
var ns = require( '@stdlib/random-iter' );

console.log( objectKeys( ns ) );
```

* * *

## Notice

This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.

For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].

#### Community

[![Chat][chat-image]][chat-url]

---

## License

See [LICENSE][stdlib-license].

## Copyright

Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].

[npm-image]: http://img.shields.io/npm/v/@stdlib/random-iter.svg
[npm-url]: https://npmjs.org/package/@stdlib/random-iter

[test-image]: https://github.com/stdlib-js/random-iter/actions/workflows/test.yml/badge.svg?branch=main
[test-url]: https://github.com/stdlib-js/random-iter/actions/workflows/test.yml?query=branch:main

[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/random-iter/main.svg
[coverage-url]: https://codecov.io/github/stdlib-js/random-iter?branch=main

[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
[chat-url]: https://app.gitter.im/#/room/#stdlib-js_stdlib:gitter.im

[stdlib]: https://github.com/stdlib-js/stdlib

[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors

[umd]: https://github.com/umdjs/umd
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules

[deno-url]: https://github.com/stdlib-js/random-iter/tree/deno
[deno-readme]: https://github.com/stdlib-js/random-iter/blob/deno/README.md
[umd-url]: https://github.com/stdlib-js/random-iter/tree/umd
[umd-readme]: https://github.com/stdlib-js/random-iter/blob/umd/README.md
[esm-url]: https://github.com/stdlib-js/random-iter/tree/esm
[esm-readme]: https://github.com/stdlib-js/random-iter/blob/esm/README.md
[branches-url]: https://github.com/stdlib-js/random-iter/blob/main/branches.md

[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/random-iter/main/LICENSE

[@stdlib/random/iter/arcsine]: https://github.com/stdlib-js/random-iter-arcsine

[@stdlib/random/iter/bernoulli]: https://github.com/stdlib-js/random-iter-bernoulli

[@stdlib/random/iter/beta]: https://github.com/stdlib-js/random-iter-beta

[@stdlib/random/iter/betaprime]: https://github.com/stdlib-js/random-iter-betaprime

[@stdlib/random/iter/binomial]: https://github.com/stdlib-js/random-iter-binomial

[@stdlib/random/iter/box-muller]: https://github.com/stdlib-js/random-iter-box-muller

[@stdlib/random/iter/cauchy]: https://github.com/stdlib-js/random-iter-cauchy

[@stdlib/random/iter/chi]: https://github.com/stdlib-js/random-iter-chi

[@stdlib/random/iter/chisquare]: https://github.com/stdlib-js/random-iter-chisquare

[@stdlib/random/iter/cosine]: https://github.com/stdlib-js/random-iter-cosine

[@stdlib/random/iter/discrete-uniform]: https://github.com/stdlib-js/random-iter-discrete-uniform

[@stdlib/random/iter/erlang]: https://github.com/stdlib-js/random-iter-erlang

[@stdlib/random/iter/exponential]: https://github.com/stdlib-js/random-iter-exponential

[@stdlib/random/iter/f]: https://github.com/stdlib-js/random-iter-f

[@stdlib/random/iter/frechet]: https://github.com/stdlib-js/random-iter-frechet

[@stdlib/random/iter/gamma]: https://github.com/stdlib-js/random-iter-gamma

[@stdlib/random/iter/geometric]: https://github.com/stdlib-js/random-iter-geometric

[@stdlib/random/iter/gumbel]: https://github.com/stdlib-js/random-iter-gumbel

[@stdlib/random/iter/hypergeometric]: https://github.com/stdlib-js/random-iter-hypergeometric

[@stdlib/random/iter/improved-ziggurat]: https://github.com/stdlib-js/random-iter-improved-ziggurat

[@stdlib/random/iter/invgamma]: https://github.com/stdlib-js/random-iter-invgamma

[@stdlib/random/iter/kumaraswamy]: https://github.com/stdlib-js/random-iter-kumaraswamy

[@stdlib/random/iter/laplace]: https://github.com/stdlib-js/random-iter-laplace

[@stdlib/random/iter/levy]: https://github.com/stdlib-js/random-iter-levy

[@stdlib/random/iter/logistic]: https://github.com/stdlib-js/random-iter-logistic

[@stdlib/random/iter/lognormal]: https://github.com/stdlib-js/random-iter-lognormal

[@stdlib/random/iter/minstd-shuffle]: https://github.com/stdlib-js/random-iter-minstd-shuffle

[@stdlib/random/iter/minstd]: https://github.com/stdlib-js/random-iter-minstd

[@stdlib/random/iter/mt19937]: https://github.com/stdlib-js/random-iter-mt19937

[@stdlib/random/iter/negative-binomial]: https://github.com/stdlib-js/random-iter-negative-binomial

[@stdlib/random/iter/normal]: https://github.com/stdlib-js/random-iter-normal

[@stdlib/random/iter/pareto-type1]: https://github.com/stdlib-js/random-iter-pareto-type1

[@stdlib/random/iter/poisson]: https://github.com/stdlib-js/random-iter-poisson

[@stdlib/random/iter/randi]: https://github.com/stdlib-js/random-iter-randi

[@stdlib/random/iter/randn]: https://github.com/stdlib-js/random-iter-randn

[@stdlib/random/iter/randu]: https://github.com/stdlib-js/random-iter-randu

[@stdlib/random/iter/rayleigh]: https://github.com/stdlib-js/random-iter-rayleigh

[@stdlib/random/iter/t]: https://github.com/stdlib-js/random-iter-t

[@stdlib/random/iter/triangular]: https://github.com/stdlib-js/random-iter-triangular

[@stdlib/random/iter/uniform]: https://github.com/stdlib-js/random-iter-uniform

[@stdlib/random/iter/weibull]: https://github.com/stdlib-js/random-iter-weibull