Forums > MaxMSP

random number generators following probability distributions?

January 4, 2011 | 4:56 pm

Hi all, i need a generator of numbers following probabilities in a gaussian distribution, binomial and poisson. Before i do it myself is there some external out there?

January 4, 2011 | 7:31 pm

Litter Pro has more random number and noise generators than are entirely probable.

January 4, 2011 | 11:25 pm




January 5, 2011 | 6:26 pm

to save others a few clicks:

expr (sqrt(-2.0*ln(1-((random(0,32767))*(1./32767.)))))*(cos(((random(0,32767))*(1./32767.))*6.283185307))

January 6, 2011 | 2:28 pm

Gaussian can be generated with a formula using two uniform deviates, as demonstrated by Roman and Samuel. The formula only produces the standard normal distribution: Gauss(0, 1). It’s not hard to map that to the general case with any mean and standard deviation, but lp.norm from Litter Power will do the grunt work for you.

Binomial and Poisson distributions aren’t quite so easy.

Litter Power actually implements four different algorithms for binomial (Bernoulli) distributions to get optimum performance depending on parameters (the simplest algorithm gets extremely CPU-intensive for some parameters). As well as using an industrial-strength core random number generator. (Those who’ve known me for a long time are probably expecting me to point out that the built in random() used in the formulae above isn’t a very reliable RNG, and I would be remiss in disappointing anyone.-)

The Litter Starter Pack gives you your (generalized) Gaussian and binomial distributions, and can be downloaded for free from the URL Chris gave (thanks, Chris!) The Starter Pack is currently really a Max4 collection, however a determined Maxer can get it to run on Max5 (but it’s not a lot of fun). The Litter Pro Bundle is Max5-savvy and also gets you Poisson, Arc-sine, Cauchy, logistic, log-normal, and another three-dozen distributions plus another dozen-and-a-half as MSP signals. It is a commercial product.

If all you want is the three named distributions, you might want to look at the "Classic" Litter Bundle, which implements these as abstractions. Also available at the same link, it is no longer actively maintained but the patchers ought to work just fine on Max5. Also free to download.

January 9, 2011 | 8:09 pm

Fantastic help. Thanks so much i downloaded Litter Bundle and works great. :)

Viewing 6 posts - 1 through 6 (of 6 total)