hi,
     
    the random() function generates numbers between 
    0 and 1, distributed "linearly" (not sure this is the proper term  
    -> statistics was a while back .....). Meaning that if you run 
    Lastvalue(random()) a million times we would about get the same hits with 
    0.9 as with 0.3.
     
    (0.5 - Random()) * 2  gives you a function 
    with numbers between -1 and 1  with a "linear" 
    distribution.
     
    What I want is to generate random numbers 
    between -1 and 1 which do not have a "linear" distribution. They should 
    have some kind of Gaussian distribution where chances a number generated 
    near 0 is greater than a number generated neat -1 or 1. 
     
    I made this Gauss function (see below) but this 
    generates numbers with a standard deviation of 1 but does not have a high or 
    low number restriction.  So I want the numbers to fluctuate randomly 
    between -1 and 1 but still have some form of Gauss function in them so that 
    a hit at 1 occurs less frequent than at 0.3.
     
    thanks,
     
    rgds, Ed
     
     
    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; 
} 
    
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