
`random` package provides `RandomGen` (used by tf-random, MonadRandom) and `Random` (instances of which are in some of [1] for sure) classes. (tf-random defines own version of those /also/) Where they should live? I'd propose having module `System.Random.Classes` in `random` (maybe more like ones in `tf-random`, though I don't like RandomGen of either one) even we deprecate the generator itself. - Oleg On 24.01.2017 15:35, Dominic Steinitz wrote:
I wanted to give an update on the status of random numbers in Haskell.
1. It is well known that the random number generator package https://hackage.haskell.org/package/random gives unexpected results. 2. Most people do *not* use it. I believe https://hackage.haskell.org/package/mwc-random is a popular choice but developers are free to use e.g. Mersenne Twister, PCG (Permuted Congruential Generator), TF (ThreeFish) and many others. 3. Approximately 2 years, I made a proposal to replace the algorithm within random (https://hackage.haskell.org/package/random) with that used by tf-random (https://hackage.haskell.org/package/tf-random) which is used by QuickCheck. In summary, the response to this was that someone should do more research with the result that nothing happened. 4. In the meantime, random (https://hackage.haskell.org/package/random) is *no longer* a core library. It's just a library with the same status as e.g. mwc-random. However, it has one difference: it uses the name for its module: "System.Random". Other RNGs use "System.Random.MWC", "System.Random.PCG", "System.Random.Mersenne" etc.
As a maintainer of random (https://hackage.haskell.org/package/random), my proposal now is to deprecate all of it.
I am not clear what the policy is on namespace usage. Could every RNG use the module name "System.Random"? Or is this somehow reserved? If the latter then I propose that *nothing* uses this name and that all RNGs should add a suffix indicating which algorithm they use.
I note that the Haskell Platform contains tf-random so users of this will still be able to generate (better) random numbers.
If someone comes along in the future, as I hope they do, and implements e.g. Guy Steele's splitmix algorithm then this can occupy the name "System.Random.Splitmix" and have the package name "random-splitmix".
The advantages of doing this are:
1. Neophyte (and experienced) Haskellers do not accidentally use an RNG which gives unexpected results. 2. No-one will any longer be able to write blogs or papers about this embarrassing aspect of Haskell.
I believe the co-maintainer of random (https://hackage.haskell.org/package/random), Carter Schonwald, has a different view on this matter but it is best he speaks for himself rather than me imperfectly trying to reflect his thinking.
Dominic Steinitz dominic@steinitz.org http://idontgetoutmuch.wordpress.com
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries