Random double

Ali Çehreli acehreli at yahoo.com
Thu Apr 25 00:35:37 PDT 2013


On 04/23/2013 11:46 PM, qznc wrote:

 > Tue, 23 Apr 2013 13:49:48 -0700: Ali Çehreli wrote

 >> Unfortunately, that will not produce a uniform distribution. The results
 >> will mostly be in the range [-0.5, 0.5]. The lower and higher values
 >> will have half the chance of the middle range:
 >
 >
 > Interesting. Why [-0.5,0.5], though? I would have expected [-1.0,1.0] 
from
 > Clugston's article.
 >
 > http://dlang.org/d-floating-point.html

Hmmm... I don't know. Interestingly, I wrote that *before* running the 
test program, which has confirmed it. So, I was correct without knowing 
why. :)

Ali



More information about the Digitalmars-d-learn mailing list