@stdlib/random-streams-box-muller-cli
v0.2.1
Published
Create a readable stream for generating pseudorandom numbers drawn from a standard normal distribution using the Box-Muller transform.
Downloads
13
Readme
Standard Normal Random Numbers
Create a readable stream for generating pseudorandom numbers drawn from a standard normal distribution using the Box-Muller transform.
Installation
To use as a general utility, install the CLI package globally
npm install -g @stdlib/random-streams-box-muller-cli
Usage
Usage: random-box-muller [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-box-muller -n 10 --seed 1234
References
- Box, G. E. P., and Mervin E. Muller. 1958. "A Note on the Generation of Random Normal Deviates." The Annals of Mathematical Statistics 29 (2). The Institute of Mathematical Statistics: 610–11. doi:10.1214/aoms/1177706645.
- Bell, James R. 1968. "Algorithm 334: Normal Random Deviates." Communications of the ACM 11 (7). New York, NY, USA: ACM: 498. doi:10.1145/363397.363547.
- Knop, R. 1969. "Remark on Algorithm 334 [G5]: Normal Random Deviates." Communications of the ACM 12 (5). New York, NY, USA: ACM: 281. doi:10.1145/362946.362996.
- Marsaglia, G., and T. A. Bray. 1964. "A Convenient Method for Generating Normal Variables." SIAM Review 6 (3). Society for Industrial; Applied Mathematics: 260–64. doi:10.1137/1006063.
- Thomas, David B., Wayne Luk, Philip H.W. Leong, and John D. Villasenor. 2007. "Gaussian Random Number Generators." ACM Computing Surveys 39 (4). New York, NY, USA: ACM. doi:10.1145/1287620.1287622.
See Also
@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-base/box-muller
: normally distributed pseudorandom numbers using the Box-Muller transform.@stdlib/random-iter/box-muller
: create an iterator for generating pseudorandom numbers drawn from a standard normal distribution using the Box-Muller transform.@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-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.