[Mono-list] Random seeding on different machines

Matt Calder mvcalder at gmail.com
Tue Oct 4 12:19:11 UTC 2016


We are seeing differences in the output of Random.Next, Random.NextDouble
when run from the same seed but on different machines. I am wondering if
this is expected.

For example, if I run:

Random rng = new Random(123);
int i=0;
double x = 0.0;
for (int i=0; i < 10000; i++) {
    i += rng.Next() % 2;
    x += rng.NextDouble();
}

on two separate machines, should I expect to see the same results? The code
in question is single threaded, but I thought there may be other issues at
work that could cause the two runs to diverge.

Thanks for any assistance,

Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-list/attachments/20161004/b13c0a4f/attachment.html>


More information about the Mono-list mailing list