[R] Random numbers

From: Carl <carl_at_mcs.st-and.ac.uk>
Date: Thu 22 Dec 2005 - 01:47:24 EST

Hi All.
I have R code whose functionality is being replicated within a C+ program. The outputs are to be compared to validate the conversion somewhat - however (as is always the case) I have stuffed my code with random number calls.

Random uniform numbers in C+ are being produced using the (Boost) mersenne-twister generators (mt11213b & mt19937) - which is the default type of generator in R (if I read things correctly). If it was all within R I would just set the seed for reproducibility.

Basically - how do I specify in C+ for a set of random uniform numbers such that they are the same as from R? I have considered the possibility of storing/using the R generated random numbers in the C+ version for validation purposes - but there are a lot of them, and that strikes me as a generally ugly way of doing things.

thanks in advance

Carl Donovan
Lecturer in statistics
Ph +44 1334 461802
The Observatory
Buchanan Gardens
University of St Andrews
St Andrews
KY16 9LZ

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Dec 22 01:52:59 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:40 EST