* Joseph Rushton Wakeling <[email protected]> [2012-04-12 16:45:34
+0200]:
> (3) Uniform random number on (0,1)
> ----
> The algorithms' specification explicitly refers to uniform random
> numbers on the open interval, which I take to mean (0,1) i.e.
> excluding zero. Phobos currently provides only a half-open uniform
> distribution on [a,b).
>
> I've implemented a simple uniform_open() function which should
> return a uniform distribution on (a,b). The question is, are there
> any plans for an open-interval uniform distribution in Phobos? Can
> I rely on this functionality being provided in the long term in D's
> standard library?
There is support for fully all 4 types of intervals using
std.random.uniform. You just specify the type of interval using a
template parameter.
The default is this: uniform!("[)")(a,b);
And you want this: uniform!("[]")(a,b);
You can also do "()" and "(]" to obtain the other two intervals
--
James Miller