https://github.com/acaloiaro/mersenne-twister-gnur
Java Mersenne-Twister implementation based on and validated against GNU R's
https://github.com/acaloiaro/mersenne-twister-gnur
prng-algorithms random-generator
Last synced: 3 months ago
JSON representation
Java Mersenne-Twister implementation based on and validated against GNU R's
- Host: GitHub
- URL: https://github.com/acaloiaro/mersenne-twister-gnur
- Owner: acaloiaro
- License: mit
- Created: 2014-11-17T20:39:04.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2021-09-24T19:26:10.000Z (about 4 years ago)
- Last Synced: 2024-04-17T20:18:09.756Z (over 1 year ago)
- Topics: prng-algorithms, random-generator
- Language: Java
- Homepage:
- Size: 407 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
mersenne-twister-gnur
=====================
A Mersenne-Twister implementation modeled after and validated with GNU R's RNG.c.
This is the PRNG in [Renjin](https://github.com/bedatadriven/renjin), a JVM-based interpreter for R.
# Examples
## Getting Ten Random Doubles with GNU R
```
set.seed(4357);
runif(10);
output: 0.4478791 0.8817665 0.8387621 0.6334931 0.3799481 0.8501577 0.8934669 0.5206094 0.5182715 0.6667043
```
## Same Results Using mersenne-twister-gnur
```
RNG.setSeed(4357);
double[] results = RNG.runif(10);
System.out.println(Arrays.toString(results));
output: [0.44787912303581834, 0.8817665143869817, 0.8387620681896806, 0.6334931093733758, 0.37994811101816595, 0.8501577137503773, 0.8934669292066246, 0.5206093506421894, 0.5182715305127203, 0.6667043350171298]
```