@stdlib/random-streams-improved-ziggurat-cli
v0.2.1
Published
Create a readable stream for generating pseudorandom numbers drawn from a standard normal distribution using the Improved Ziggurat algorithm.
Downloads
5
Readme
Standard Normal Random Numbers
Create a readable stream for generating pseudorandom numbers drawn from a standard normal distribution using the Improved Ziggurat algorithm.
Installation
To use as a general utility, install the CLI package globally
npm install -g @stdlib/random-streams-improved-ziggurat-cli
Usage
Usage: random-improved-ziggurat [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.
--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-improved-ziggurat -n 10 --seed 1234
References
- Doornik, Jurgen A. 2005. "An Improved Ziggurat Method to Generate Normal Random Samples." <https://www.doornik.com/research/ziggurat.pdf>.
- Marsaglia, George, and Wai Wan Tsang. 2000. "The Ziggurat Method for Generating Random Variables." Journal of Statistical Software 5 (1): 1–7. doi:10.18637/jss.v005.i08.
- Marsaglia, George. 1964. "Generating a Variable from the Tail of the Normal Distribution." Technometrics 6 (1): 101–2. doi:10.1080/00401706.1964.10490150.
See Also
@stdlib/random-streams-improved-ziggurat
: create a readable stream for generating pseudorandom numbers drawn from a standard normal distribution using the Improved Ziggurat algorithm.@stdlib/random-base/improved-ziggurat
: normally distributed pseudorandom numbers using the improved Ziggurat method.@stdlib/random-iter/improved-ziggurat
: create an iterator for generating pseudorandom numbers drawn from a standard normal distribution using the Improved Ziggurat algorithm.@stdlib/random-streams/box-muller
: create a readable stream for generating pseudorandom numbers drawn from a standard normal distribution using the Box-Muller transform.@stdlib/random-streams/randn
: create a readable stream for generating pseudorandom numbers drawn from a standard normal distribution.
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.