ANNOUNCE: normaldistribution-1.1 – Minimum fuss normally distributed random values.

Dear all,
Thanks to enlightening advice from Tom Nielsen and Zoltan Novak
normaldistribution now generates normally distributed values using the
Box-Muller method instead of the Central Limit Theorem. This change
provides a 5-10x speedup.
The only API impact is that the random values must now be instances of
Floating rather than just Fractional. (The pre-canned Random instances
that satisfy Fractional, i.e. Double and Float, also satisfy
Floating.)
Cheers,
Bjorn
---------- Forwarded message ----------
From: Bjorn Buckwalter
(sample,g) = normal myRandomGen -- using a Random.RandomGen samples = normals myRandomGen -- infinite list samples2 = mkNormals 10831452 -- infinite list using a seed
In the IO monad:
sample <- normalIO samples <- normalsIO -- infinite list
With custom mean and standard deviation:
(sample,g) = normal' (mean,sigma) myRandomGen samples = normals' (mean,sigma) myRandomGen samples2 = mkNormals' (mean,sigma) 10831452
sample <- normalIO' (mean,sigma) samples <- normalsIO' (mean,sigma)
Internally the library uses the Central Limit Theorem to approximate normally distributed values from multiple uniformly distributed random values. Enjoy, Bjorn
participants (1)
-
Bjorn Buckwalter