<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, 24 Jan 2017 at 14:36 Dominic Steinitz <<a href="mailto:dominic@steinitz.org">dominic@steinitz.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I wanted to give an update on the status of random numbers in Haskell.<br class="gmail_msg">
<br class="gmail_msg">
 1. It is well known that the random number generator package<br class="gmail_msg">
    <a href="https://hackage.haskell.org/package/random" rel="noreferrer" class="gmail_msg" target="_blank">https://hackage.haskell.org/package/random</a> gives unexpected<br class="gmail_msg">
    results.<br class="gmail_msg">
 2. Most people do *not* use it. I believe<br class="gmail_msg">
    <a href="https://hackage.haskell.org/package/mwc-random" rel="noreferrer" class="gmail_msg" target="_blank">https://hackage.haskell.org/package/mwc-random</a> is a popular choice<br class="gmail_msg">
    but developers are free to use e.g. Mersenne Twister, PCG<br class="gmail_msg">
    (Permuted Congruential Generator), TF (ThreeFish) and many others.<br class="gmail_msg">
 3. Approximately 2 years, I made a proposal to replace the algorithm<br class="gmail_msg">
    within random (<a href="https://hackage.haskell.org/package/random" rel="noreferrer" class="gmail_msg" target="_blank">https://hackage.haskell.org/package/random</a>) with<br class="gmail_msg">
    that used by tf-random<br class="gmail_msg">
    (<a href="https://hackage.haskell.org/package/tf-random" rel="noreferrer" class="gmail_msg" target="_blank">https://hackage.haskell.org/package/tf-random</a>) which is used by<br class="gmail_msg">
    QuickCheck. In summary, the response to this was that someone<br class="gmail_msg">
    should do more research with the result that nothing happened.<br class="gmail_msg">
 4. In the meantime, random<br class="gmail_msg">
    (<a href="https://hackage.haskell.org/package/random" rel="noreferrer" class="gmail_msg" target="_blank">https://hackage.haskell.org/package/random</a>) is *no longer* a core<br class="gmail_msg">
    library. It's just a library with the same status as<br class="gmail_msg">
    e.g. mwc-random. However, it has one difference: it uses the name<br class="gmail_msg">
    for its module: "System.Random". Other RNGs use<br class="gmail_msg">
    "System.Random.MWC", "System.Random.PCG", "System.Random.Mersenne"<br class="gmail_msg">
    etc.<br class="gmail_msg">
<br class="gmail_msg">
As a maintainer of random<br class="gmail_msg">
(<a href="https://hackage.haskell.org/package/random" rel="noreferrer" class="gmail_msg" target="_blank">https://hackage.haskell.org/package/random</a>), my proposal now is to<br class="gmail_msg">
deprecate all of it.<br class="gmail_msg">
<br class="gmail_msg">
I am not clear what the policy is on namespace usage. Could every RNG<br class="gmail_msg">
use the module name "System.Random"? Or is this somehow reserved? If<br class="gmail_msg">
the latter then I propose that *nothing* uses this name and that all<br class="gmail_msg">
RNGs should add a suffix indicating which algorithm they use.<br class="gmail_msg"></blockquote><div><br></div><div>They *could* use the same namespace but I don't recommend it. If someone depends on two of these packages they would have to use PackageImports. Tools such as doctest break if a package db has module conflicts, even if only one of the packages is listed as a dependency.</div><div> </div><div>Cheers,</div><div>Adam</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="gmail_msg">
I note that the Haskell Platform contains tf-random so users of this<br class="gmail_msg">
will still be able to generate (better) random numbers.<br class="gmail_msg">
<br class="gmail_msg">
If someone comes along in the future, as I hope they do, and<br class="gmail_msg">
implements e.g. Guy Steele's splitmix algorithm then this can occupy<br class="gmail_msg">
the name "System.Random.Splitmix" and have the package name<br class="gmail_msg">
"random-splitmix".<br class="gmail_msg">
<br class="gmail_msg">
The advantages of doing this are:<br class="gmail_msg">
<br class="gmail_msg">
 1. Neophyte (and experienced) Haskellers do not accidentally use an<br class="gmail_msg">
    RNG which gives unexpected results.<br class="gmail_msg">
 2. No-one will any longer be able to write blogs or papers about this<br class="gmail_msg">
    embarrassing aspect of Haskell.<br class="gmail_msg">
<br class="gmail_msg">
I believe the co-maintainer of random<br class="gmail_msg">
(<a href="https://hackage.haskell.org/package/random" rel="noreferrer" class="gmail_msg" target="_blank">https://hackage.haskell.org/package/random</a>), Carter Schonwald, has a<br class="gmail_msg">
different view on this matter but it is best he speaks for himself<br class="gmail_msg">
rather than me imperfectly trying to reflect his thinking.<br class="gmail_msg">
<br class="gmail_msg">
Dominic Steinitz<br class="gmail_msg">
<a href="mailto:dominic@steinitz.org" class="gmail_msg" target="_blank">dominic@steinitz.org</a><br class="gmail_msg">
<a href="http://idontgetoutmuch.wordpress.com" rel="noreferrer" class="gmail_msg" target="_blank">http://idontgetoutmuch.wordpress.com</a><br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
Libraries mailing list<br class="gmail_msg">
<a href="mailto:Libraries@haskell.org" class="gmail_msg" target="_blank">Libraries@haskell.org</a><br class="gmail_msg">
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" class="gmail_msg" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br class="gmail_msg">
</blockquote></div></div>