>>>>> On Tue, 12 May 2009 13:30:21 +0300, >>>>> Klaus Nordhausen (KN) wrote:
> Dear R experts, > we are preparing an R-package to compute the Oja Median which contains > some C++ code in which random numbers are needed. To generate the random > numbers we use the following Mersenne-Twister implementation: > // MersenneTwister.h > // Mersenne Twister random number generator -- a C++ class MTRand > // Based on code by Makoto Matsumoto, Takuji Nishimura, and Shawn Cokus > // Richard J. Wagner v1.0 15 May 2003 rjwag...@writeme.com > the random seed for the Mersenne-Twister is provided by our R-function > which gives an (random) integer to the C++ function srand() which in > turn sets the seed in the code. > Using the set.seed in R makes now the results reproducible, but the > results differ between windows and linux. > Does anyone know what the problem there is? [...] I cannot directly help with the problem, but one quick question: Why do you ship your own random number generator rather than use the one that ships with R (which by default is Mersenne Twister anyway)? The API is documented in "Writing R Extensions". The advantage in using R's RNG is that the user can change it, e.g., to take care of streams for parallel processing on clusters etc Best, Fritz -- ----------------------------------------------------------------------- Prof. Dr. Friedrich Leisch Institut für Statistik Tel: (+49 89) 2180 3165 Ludwig-Maximilians-Universität Fax: (+49 89) 2180 5308 Ludwigstraße 33 D-80539 München http://www.statistik.lmu.de/~leisch ----------------------------------------------------------------------- Journal Computational Statistics --- http://www.springer.com/180 Münchner R Kurse --- http://www.statistik.lmu.de/R ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel