haskell / random

Random number library
Other
53 stars 50 forks source link

Rewrite `shiffleListM` using array #158

Open lehins opened 8 months ago

lehins commented 8 months ago

Initial version of shuffleListM was introduced in #140

Current implementation is very simple and suboptimal, as pointed out in this comment

We need some basic array support with mutation in order to implement Fisher-Yates shuffle. Here is an example of such implementation

I suggest we postpone this implementation until we get #157 taken care of. Which would allow us to depend on primitive, thus making efficient and bias free implementation of shuffleList trivial.