Boost logo

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)


2. With boost I tried :

boost::mt19937 rng(13);
boost::uniform_01<boost::mt19937> zeroone(rng);
std::cout << zeroone() << std::endl;


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)..

Ronan Trépos

Trépos Ronan
INRA unité BIA, équipe MAD, Toulouse
tel : 05 61 28 53 34

Boost list run by bdawes at, gregod at, cpdaniel at, john at