@stdlib/random-streams-mt19937-cli
v0.2.1
Published
Create a readable stream for a 32-bit Mersenne Twister pseudorandom number generator.
Downloads
5
Readme
MT19937
Create a readable stream for a 32-bit Mersenne Twister pseudorandom number generator.
Installation
To use as a general utility, install the CLI package globally
npm install -g @stdlib/random-streams-mt19937-cli
Usage
Usage: random-mt19937 [options]
Options:
-h, --help Print this message.
-V, --version Print the package version.
--sep sep Separator used to join streamed data. Default: '\n'.
-n, --iter iterations Number of pseudorandom numbers.
--normalized Generate pseudorandom numbers on the interval [0,1).
--seed seed Pseudorandom number generator seed.
--state filepath Path to a file containing the pseudorandom number
generator state.
--snapshot filepath Output file path for saving the pseudorandom number
generator state upon exit.
Notes
- In accordance with POSIX convention, a trailing newline is always appended to generated output prior to exit.
- Specifying a "snapshot" file path is useful when wanting to resume pseudorandom number generation due to, e.g., a downstream failure in an analysis pipeline. Before exiting, the process will store the pseudorandom number generator state in a file specified according to a provided file path. Upon loading a snapshot (state), the process will generate pseudorandom numbers starting from the loaded state, thus avoiding having to seed and replay an entire analysis.
Examples
$ random-mt19937 -n 10 --seed 1234
References
- Matsumoto, Makoto, and Takuji Nishimura. 1998. "Mersenne Twister: A 623-dimensionally Equidistributed Uniform Pseudo-random Number Generator." ACM Transactions on Modeling and Computer Simulation 8 (1). New York, NY, USA: ACM: 3–30. doi:10.1145/272991.272995.
- Harase, Shin. 2017. "Conversion of Mersenne Twister to double-precision floating-point numbers." ArXiv abs/1708.06018 (September). https://arxiv.org/abs/1708.06018.
See Also
@stdlib/random-streams-mt19937
: create a readable stream for a 32-bit Mersenne Twister pseudorandom number generator.@stdlib/random-base/mt19937
: A 32-bit Mersenne Twister pseudorandom number generator.@stdlib/random-iter/mt19937
: create an iterator for a 32-bit Mersenne Twister pseudorandom number generator.@stdlib/random-streams/minstd
: create a readable stream for a linear congruential pseudorandom number generator (LCG) based on Park and Miller.@stdlib/random-streams/minstd-shuffle
: create a readable stream for a linear congruential pseudorandom number generator (LCG) whose output is shuffled.@stdlib/random-streams/randi
: create a readable stream for generating pseudorandom numbers having integer values.@stdlib/random-streams/randu
: create a readable stream for generating uniformly distributed pseudorandom numbers between 0 and 1.
Notice
This package is part of 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, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2024. The Stdlib Authors.