I am trying to find the best way to draw from a normal distribution. I want to be able to use the normal probability density function (and its cumulative) in Haskell.
To put it simply, I want to use the functions on this page without using the GSL binding... I am struggling to find the right package. Which one would you say is the best?
Thank you and have a great day!
Here's an example which uses random-fu:
Run it and you'll see the following output:
There are 2 important points here:
Normal
is a constructor defining a distribution. There are other distributions, such asUniform
, etc. Distributions have different types, but they all belong to theDistribution
class.pdf
andcdf
are class methods, which can operate on many distributions (perhaps not all, but many). The 1st parameter is the distribution and the 2nd – point at which PDF/CDF should be evaluated.