Random Gaussian Number Generator

From Second Life Wiki
Revision as of 12:10, 26 December 2010 by Vlad Davidson (talk | contribs) (Created page with "<lsl> float randGauss(float mean=0.,float stdev=1.){ float V1,V2,S; do{ V1=2*llFrand(1.)-1; V2=2*llFrand(1.)-1; S=V1*V1+V2*V2; }while (S>=1); return mean+stdev*V1*llSqr…")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<lsl> float randGauss(float mean=0.,float stdev=1.){ float V1,V2,S; do{ V1=2*llFrand(1.)-1; V2=2*llFrand(1.)-1; S=V1*V1+V2*V2; }while (S>=1); return mean+stdev*V1*llSqrt(-2*(llLog(S)/S)); } </lsl>