
5 Aug
2010
5 Aug
'10
8:32 p.m.
AMDG Ronan Trépos wrote:
For validity concerns, I'm trying to reproduce pseudo random numbers generated by the sofware R with boost::random library. The R default number generator is the Mersenne-Twister with period 2^19937 -1 .
1. In R I tried :
set.seed(13) runif(1)
0.7103224
2. With boost I tried :
boost::mt19937 rng(13); boost::uniform_01<boost::mt19937> zeroone(rng); std::cout << zeroone() << std::endl;
0.777702
Has someone already experienced that ? Is it possible to reproduce the same numbers ? Maybe the mismatch comes from the fact that generated integers are translated into [0;1)..
I don't think so. I think the difference is that R uses its own seeding algorithm. In Christ, Steven Watanabe