On Dec 14, 9:40 am, Konrad Hinsen <konrad.hin...@laposte.net> wrote: > Isn't that the standard Box-Muller transform?
Ah, yes, now I know what to call it ;-) Yes, it's a particular implementation of the Box-Muller transform that is designed to avoid trig functions. http://en.wikipedia.org/wiki/Marsaglia_polar_method > (defn transform-to-gaussian > "Transform a sequence of uniform random number in the interval [0, 1) > into a sequence of Gaussian random numbers." > [uniform-seq] > (let [[U1 U2 & uniform-rest] uniform-seq Yes, much better ;-) > (lazy-cons X1 (lazy-cons X2 (transform-to-gaussian uniform- > rest)))))) Also much better -- the structs were ugly. Thanks for the nice revision! Do you think type hints on the double-floats could give some performance benefit? I'm curious where the type hints would go but too lazy to try the "add them everywhere and remove one by one until performance decreases" approach. mfh --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---