[Mono-list] Random seeding on different machines

Sebastien Pouliot sebastien.pouliot at gmail.com
Tue Oct 4 15:04:00 UTC 2016

Bonjour Matt.

You probably have different versions of Mono on those computers. In the
past both Mono and MS had different implementation for Random. Now that
Mono is using the open sourced MS reference source this is "fixed", but it
means current Mono Random's output won't be compatible with earlier

For simulation purpose I suggest you to use/include a well known PRNG and
not depend on the platform. That will make it easier in case you ever have
to run the same code on a different (e.g. not .NET) runtime.


On Tue, Oct 4, 2016 at 10:09 AM, Matt Calder <mvcalder at gmail.com> wrote:

> Edward,
> Thanks this is a non-crypto application. We are doing simulations across
> machines and want to know if we can expect identical runs to match. It
> sounds like you are saying "no".
> Matt
> On Tue, Oct 4, 2016 at 10:02 AM, Edward Ned Harvey (mono) <
> edward.harvey.mono at clevertrove.com> wrote:
>> > From: Mono-list [mailto:mono-list-bounces at lists.dot.net] On Behalf Of
>> Matt
>> > Calder
>> >
>> > 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.
>> The implementation of the non-crypto random functions is not to be
>> assumed. That is - you should not use it for crypto purposes. You will
>> often have predictable results, but you should not count on the results
>> being predictable, as the underlying implementation is not in the spec, so
>> the implementation is subject to change.
>> If you require a predictable result from a starting seed, you're looking
>> for a DRBG, or PRNG, with a known standard implementation. There are some
>> NIST standards out there that define such DRBG's, and there are some
>> implementations of those available in some crypto libraries such as
>> bouncycastle, but it would basically be a research topic to figure it all
>> out if you want to go that way. The really simple way to do it, assuming
>> you want a predictable result, and you're not concerned with security, is
>> to just put an AES class into CBC mode, and give in a seed for the key and
>> IV. Wrap it in a CryptoStream. You'll have predictable random output,
>> fairly low cost.
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.dot.net
> http://lists.dot.net/mailman/listinfo/mono-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-list/attachments/20161004/99440427/attachment.html>

More information about the Mono-list mailing list