Thanks Duncan for your reply. However I could not understand this: 'R provides 
ways to call its RNGs from C'. Can you be more detailed what I need to do here? 
 
Thanks,


----- Original Message -----
From: Duncan Murdoch <murdoch.dun...@gmail.com>
To: Ron Michael <ron_michae...@yahoo.com>
Cc: "r-help@r-project.org" <r-help@r-project.org>
Sent: Saturday, 6 August 2011 1:24 AM
Subject: Re: [R] Question on RNG

On 11-08-05 2:17 PM, Ron Michael wrote:
> Hi all, I have happened to work on MS .NET for sometime now, and I found that 
> this language offers RNG what is called as Donald E. Knuth's subtractive 
> random number generator algorithm (found here: 
> http://msdn.microsoft.com/en-us/library/system.random.aspx#Y12).
> 
> Here I was wondering whether R also have same RNG in it's inventory, so 
> looked at ?set.seed. There I found 2 related RNGs namely 'Knuth-TAOCP-2002', 
> 'Knuth-TAOCP'. Can somebody guide me what is the most related RNG with .Net's?
> 
> I also want to have R to draw random number from that RNG, given I set a 
> seed. My goal is to have same set of random numbers in .Net&  R, so that I 
> can match and see and compare the performance for some further calculations, 
> which are based on random numbers in both .Net&  R.
> 
> It will be really great to me if somebody can help me out.

As far as I know, Microsoft doesn't publish the code for their RNG. Naming it 
is not enough -- implementations that differ in subtle details will give 
different streams.

So I'd recommend that you call a known RNG from .NET, rather than whatever is 
built in.  R provides ways to call its RNGs from C, so it's probably possible 
to call it from .NET:  then you can be sure the two streams are identical.

Duncan Murdoch


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to