@stdlib/random-streams-minstd-cli

0.2.1 • Public • Published
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!

MINSTD

NPM version Build Status Coverage Status

Create a readable stream for a linear congruential pseudorandom number generator (LCG) based on Park and Miller.

Installation

To use as a general utility, install the CLI package globally

npm install -g @stdlib/random-streams-minstd-cli

Usage

Usage: random-minstd [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-minstd -n 10 --seed 1234

References

  • Park, S. K., and K. W. Miller. 1988. "Random Number Generators: Good Ones Are Hard to Find." Communications of the ACM 31 (10). New York, NY, USA: ACM: 1192–1201. doi:10.1145/63039.63042.
  • Press, William H., Brian P. Flannery, Saul A. Teukolsky, and William T. Vetterling. 1992. Numerical Recipes in C: The Art of Scientific Computing, Second Edition. Cambridge University Press.

See Also


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

Chat


License

See LICENSE.

Copyright

Copyright © 2016-2024. The Stdlib Authors.

Package Sidebar

Install

npm i @stdlib/random-streams-minstd-cli

Homepage

stdlib.io

Weekly Downloads

1

Version

0.2.1

License

Apache-2.0

Unpacked Size

28.2 kB

Total Files

7

Last publish

Collaborators

  • stdlib-bot
  • kgryte
  • planeshifter
  • rreusser