Posts filed under “random”
More Random fun
The next obvious functions after “Pick†are “Unpick†to eject a value randomly from the list, and “Pick N†values from the list. unpick is fairly straight-forward. To do in a single pass, you have to thread through the list of values, but otherwise it's more or less the same as the previous code for […]
Random pain in Haskell
Random numbers seem to be a bit of a pain in Haskell. Because they are not a “pure†function (they involve hooking up with a system or user-supplied random number generator) there is a little scaffolding involved. Also when the number comes back, it's wrapped in an IO Ref, making the whole of your function […]