[Mono-osx] bug in Random
Iain Collins
mono-osx at iaincollins.com
Sun Jan 25 16:59:27 EST 2009
On 25 Jan 2009, at 20:17, Duane Wandless wrote:
> Rodrigo is on the Mono team and has already answered you.
>
> Not very obvious he (kumpera at gmail.com) is on the Mono team...
> actually it just seemed like the response was from a random mono
> user. Ha! Joke aside, that is what I thought.
>
> Anyway... for what it is worth, I disagree. The advantage of having
> the same pseudo random numbers given the same seed is important.
> Yes I can write my own algorithm to accomplish that but I prefer not
> to reinvent the wheel. That was and most of the time is one of the
> biggest advantages of Mono. I do not have to rewrite code... I can
> reuse from Windows to Mac to Linux and I can focus on the core
> functionality of my applications. Not random differences between
> the OSes or random programming languages specific to that OS.
>
> My only request is that the decision not to provide the same
> functionality as the Microsoft's library in this case was indeed by
> design and not a random decision by some random developer.
>
> Okay -- enough random jokes... but the request is legit.
>
> Thanks for the responses.
> Duane
I agree with you Duane - many applications rely on pseudo-random
number generators behaving consistently with a given seed across
different platforms (Java's implementation also works this way).
RNGCryptoServiceProvider explicitly provided for applications which
require random numbers suitable for secure, cryptograph purposes.
I've been caught out by Mono's implementation being different too
(with a test app, designed to perform a large number of requests in a
repeatable way depending on the seed). It does seem, looking back
through mailing lists & CVS history, that the original intention was
for the Mono implementation to behave the same way as Microsoft's
Knuth based implementation, but that was a few years ago. Maybe
Microsoft created an implementation that's hard to replicate reliably
so trying to replicate it was abandoned.
I have a suspicion that this issue is likely to come up again for as
long as the Mono implementation of Random remains different to
Microsoft's .NET version.
If it's not practically possible to get the Mono implementation behave
the same way, then the best that can be done is I guess to indicate
very clearly in the documentation they they behave differently. I
don't they should behave differently just for the sake of it. Maybe
dedicating a page on the Mono website to highlighting subtle
differences like this would be a good idea.
Best regards,
--
Iain Collins
More information about the Mono-osx
mailing list