Skip to content

Commit eac84eb

Browse files
XuhuaHuangCopilot
andcommitted
Study quality of RNG
Co-authored-by: Copilot <copilot@github.com>
1 parent a12d9f4 commit eac84eb

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

R/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,18 @@ legend("topright",
521521
### Mersenne-Twister RNG (R’s default RNG)
522522

523523
- Pseudorandom number generator developed in 1997 by Matsumoto and Nishimura
524-
- Period: 2^19937 − 1
524+
- Period: `2^19937 − 1`
525+
- Pseudo-RNG is good as long as it has an extremely long period (cycle)
525526
- Seed: a 624-dimensional set of 32-bit integers plus a current position in that set
526527
- The Mersenne Twister is designed with Monte Carlo simulations and other statistical simulations in mind
527528
- For non-parallel RNG, this is probably the best RNG
528529
- http://en.wikipedia.org/wiki/Mersenne_twister
530+
531+
### Quality of RNG
532+
533+
Since a RNG normally uses a deterministic algorithm, its randomness property is important.
534+
535+
- Kolmogorov-Smirnov test: Goodness-of-fit test; test uniform distribution
536+
- `R` function `ks.test`
537+
- Try: `x = seq(0, 1, length = 10000)`
538+
- The longest runs of head

0 commit comments

Comments
 (0)