Skip to content

Commit f138118

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

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

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

lib/node_modules/@stdlib/random/streams/mt19937/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+
- [Mersenne Twister][@stdlib/random/base/mt19937] is **not** a cryptographically secure PRNG, as the PRNG is based on a linear recursion. Any pseudorandom number sequence generated by a linear recursion is **insecure**, due to the fact that one can predict future generated outputs by observing a sufficiently long subsequence of generated values.
344+
- The PRNG has a period of `2^19937 - 1`.
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-mt19937 -n 10 --seed 1234
449451

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

454+
* * *
455+
456+
<section class="references">
457+
458+
## References
459+
460+
- 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][@matsumoto:1998a].
461+
- Harase, Shin. 2017. "Conversion of Mersenne Twister to double-precision floating-point numbers." _ArXiv_ abs/1708.06018 (September). <https://arxiv.org/abs/1708.06018>.
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-mt19937 -n 10 --seed 1234
461476

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

479+
[@matsumoto:1998a]: https://doi.org/10.1145/272991.272995
480+
464481
</section>
465482

466483
<!-- /.links -->

0 commit comments

Comments
 (0)