I can’t figure out how to use Data.Random.Source.IO to generate random numbers in a multiplatform way.
I can generate random numbers in Unix using Data.Random.Source.DevRandom, and there is an example in the GitHub documentation for Windows using Data.Random.Source.MWC, but there is no example code for using Data.Random.Source.IO.
Ok I have converted the github example to use
Source.IOYou can see in the source of
Data.Random.Source.IOthat it just defines the suitable instance forMonadRandom IO.You can generate a uniform random number from a list as