Random double
qznc
qznc at go.to
Tue Apr 23 07:43:14 PDT 2013
I want to generate a random "double" value, excluding wierdos
like NaN and Infinity. However, std.random.uniform seems to be
useless. I tried things like
std.random.uniform( double.min, double.max);
std.random.uniform(-double.max, double.max);
std.random.uniform(0.0, double.max);
However, I just get Inf values. :(
I assume this is due to floating point computation within
uniform, which easily becomes Inf, if you come near the
double.max boundary. Should that be considered a bug?
Nevertheless, any ideas how to work around that issue?
More information about the Digitalmars-d-learn
mailing list