haskellgslhmatrix

How to advance the RNG state when sampling random distributions using hmatrix-gsl-stats?


How do I advance the RNG in the hmatrix-gsl-stats when I'm sampling from a random distribution: For example:

λ> CN.random_1p Exponential 235252 1.0
0.8742160459331277
λ> CN.random_1p Exponential 235252 1.0
0.8742160459331277

I don't see an obvious interface to maintain the state of the RNG in https://hackage.haskell.org/package/hmatrix-gsl-stats-0.2.1/docs/Numeric-GSL-Distribution-Continuous.html


Solution

  • The API in that package doesn't seem to offer any operations that return updated seeds (which is obviously a big no-no when doing randomness in a pure language). You will have to patch the package to return updated seeds or use a different package.