Random Gaussian Number Generator: Difference between revisions

From Second Life Wiki
Jump to navigation Jump to search
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…"
(No difference)

Revision as of 12:10, 26 December 2010

<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>