From: Daniel James (daniel_james_at_[hidden])
Date: 2006-03-18 10:28:17
Matthias Troyer wrote:
> It is actually very important that uniform_real creates numbers in a
> half-open interval, and all random number libraries are actually
> implemented that way. To give just one example, the exponential
> distribution need to evaluate an expression like
> where u is a uniform random number in the interval [0,1.). If instead
> u were from the interval [0,1], it could take on the value 1.,
> leading to a zero argument to the log, and thus a problem. The half-
> open interval is thus the right thing to do.
Sorry, I was mistaken about this. I thought that the output of mt19937
was being fed directly into uniform_real, but what actually happens is
that boost::variate_generator detects this situation and first uses
boost::uniform_01 to correctly convert the distribution into a half-open
one. This also explains a lot of the other things which were puzzling me.