[R] set random numbers seed for different cpu's

R. Michael Weylandt michael.weylandt at gmail.com
Thu Nov 17 21:45:06 CET 2011

Sorry -- that came off as very muddled.

What I meant to say:

To make it (almost) certain you will get different results on each
machine, you can reset the PRNG seed on each machine in some way
unique to that machine. What immediately came to mind was IP address,
which you can access with something like this:

x <- system("curl -s http://checkip.dyndns.org | sed 's/[a-zA-Z/<>
:]//g' ", intern = TRUE)
# Note you might have to tweak it for your OS


On Thu, Nov 17, 2011 at 3:31 PM, R. Michael Weylandt
<michael.weylandt at gmail.com> wrote:
> http://search.dilbert.com/comic/Random%20Number%20Generator
> In all seriousness, you could set the seed differently on each machine
> after putting jobs through Torque (i.e., as part of the batch script,
> maybe using some piece of hardware id you can get through system()
> somehow or other: possibly network id?) and you're very,very,very,very
> likely to get different results.
> Michael
> On Thu, Nov 17, 2011 at 9:30 AM, fantomas <tomas.iesmantas at gmail.com> wrote:
>> Hi
>> I'm running the same R script (throuth linux shell)  of several cpu's. This
>> R program uses random numbers and the result should be different every time.
>> But if put jobs (through Torque) for several cpu's I get the same result. As
>> a resealt my program saves numbers in file with randomly generated names.
>> works like a charm on one cpu, but I get the same result from different
>> cpu's.
>> So my question is, how can I resolve this? How to set pseudo random number
>> seed so that different cpu's would produce different results?
>> Thank you in advance.
>> --
>> View this message in context: http://r.789695.n4.nabble.com/set-random-numbers-seed-for-different-cpu-s-tp4080165p4080165.html
>> Sent from the R help mailing list archive at Nabble.com.
>> ______________________________________________
>> R-help at 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.

More information about the R-help mailing list