No pseudo-random library in Purescript?

I wanted to implement an algorithm that needs randomness at some point. I saw that there is purescript-random and even purescript-pseudo-random, but that one isn’t in my packages set anymore. Have I missed a package that implements pseudo-random number generation, or does none exist currently?

It could probably use a couple of functions adding to it to be a little more helpful though, since there’s not even a way to produce a [0, 1] ranged number out of the box (instead need to divide the current seed value by lcgM after converting both to Number).

3 Likes

The quickcheck library also has some pseudo random number generation conveniences. For example, choose might be what you’re looking for. Here’s another example of using quickcheck for pseudo random generation.

There’s a discussion on whether to move these quickcheck features to a more discoverable location:

1 Like