Skip to content

Commit 2321921

Browse files
committed
Add notes and references
1 parent 1be9b76 commit 2321921

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

  • lib/node_modules/@stdlib/random/streams/minstd

lib/node_modules/@stdlib/random/streams/minstd/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,8 @@ function onState( state ) {
340340

341341
## Notes
342342

343+
- The generator has a period of approximately `2.1e9` (see [Numerical Recipes in C, 2nd Edition](#references), p. 279).
344+
- An [LCG][@stdlib/random/base/minstd] is fast and uses little memory. On the other hand, because the generator is a simple [linear congruential generator][@stdlib/random/base/minstd], the generator has recognized shortcomings. By today's PRNG standards, the generator's period is relatively short. More importantly, the "randomness quality" of the generator's output is lacking. These defects make the generator unsuitable, for example, in Monte Carlo simulations and in cryptographic applications.
343345
- If PRNG state is "shared" (meaning a state array was provided during stream creation and **not** copied) and one sets the generator state to a state array having a different length, the underlying PRNG does **not** update the existing shared state and, instead, points to the newly provided state array. In order to synchronize PRNG output according to the new shared state array, the state array for **each** relevant PRNG must be **explicitly** set.
344346
- If PRNG state is "shared" and one sets the generator state to a state array of the same length, the PRNG state is updated (along with the state of all other PRNGs sharing the PRNG's state array).
345347
- In order to capture the PRNG state after a specific number of generated pseudorandom numbers, regardless of internal stream buffering, use the `siter` option in conjunction with a `state` event listener. Attempting to capture the underlying PRNG state after **reading** generated numbers is **not** likely to give expected results, as internal stream buffering will mean more values have been generated than have been read. Thus, the state returned by the `state` property will likely reflect a future PRNG state from the perspective of downstream consumers.
@@ -449,6 +451,19 @@ $ random-minstd -n 10 --seed 1234
449451

450452
<!-- /.cli -->
451453

454+
* * *
455+
456+
<section class="references">
457+
458+
## References
459+
460+
- 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][@park:1988].
461+
- 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.
462+
463+
</section>
464+
465+
<!-- /.references -->
466+
452467
<section class="links">
453468

454469
[stream]: https://nodejs.org/api/stream.html
@@ -461,6 +476,8 @@ $ random-minstd -n 10 --seed 1234
461476

462477
[@stdlib/array/int32]: https://github.com/stdlib-js/stdlib
463478

479+
[@park:1988]: http://dx.doi.org/10.1145/63039.63042
480+
464481
</section>
465482

466483
<!-- /.links -->

0 commit comments

Comments
 (0)