import std.random;
void main()
{
auto f = uniform(0.0, 1.0);
}
$ dmd -m64 -profile profile.d
$ ./profile
object.Exception@dmd/linux/bin/../../src/phobos/std/random.d(932): Invalid distribution range: [0, 0)
----------------
Compiling it without -profile or m64 works.
Comment #1 by hoganmeier — 2011-08-07T17:37:49Z
Another case:
import std.random;
void main()
{
double r1=2*uniform(0.0, 1.0);
double r2=2*uniform(0.0, 1.0);
}
It only fails if both declarations are present.
invalid bounding interval [7.69602e+169, -nan)
btw, if -inline is added, it yields:
invalid bounding interval [7.29112e-304, 1.12477e+218)
Comment #2 by code — 2012-03-15T13:52:38Z
I can't reproduce this.
What are your compiler version and parameters.
Floating point causes incorrect values, no errors, reduced down to this code:
import std.random : uniform;
void main() {
uniform(0.0f, 1.0f);
}
uniform returns values around 1.4203e+31