|
Boost : |
Subject: [boost] [Random] reproducing numbers generated by R.
From: Ronan Trépos (Ronan.Trepos_at_[hidden])
Date: 2010-08-05 11:10:58
Dear Boost community,
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)..
Thanks,
Ronan Trépos
-- Trépos Ronan INRA unité BIA, équipe MAD, Toulouse http://carlit.toulouse.inra.fr/wikiz/index.php/Ronan_TREPOS tel : 05 61 28 53 34
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk