| 
 I closely approximated 
what I want to achieve by dividing the output of the function by 4. 
Now all numbers lie between -1 and 1 about 99.9% of the time. Close enough 
:-) 
  
  
  
  
function gauss_func() { 
     w = 1;     while( w >= 1 ) { 
        x1 = 2.0 * LastValue(Random()) - 1; 
       x2 = 2.0 * LastValue(Random()) - 1; 
       w = x1 * x1 + x2 * x2; 
     } 
     w = sqrt( (-2 * log(w)) / w ); 
    y1 = x1 * w;     //y2 = x2 * w; 
         return y1 / 4; 
  } 
 
  // fill array with ranom 
numbers  hh = 0;  for (i = 0; i < BarCount; 
i++) { 
     hh[ i ] = gauss_func(); 
  } 
  Plot(hh,"Gaussian distributed random 
numbers",colorWhite,8 | 16); 
 
  
Please note that this group is for discussion between users only. 
 
To get support from AmiBroker please send an e-mail directly to  
SUPPORT {at} amibroker.com 
 
For other support material please check also: 
http://www.amibroker.com/support.html 
 
  
 
 
Yahoo! Groups Links 
 |