Bug 3785 – std.random.uniform(bound,uint,uint)(uint.min,uint.max) fails.

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2010-02-08T23:56:00Z
Last change time
2015-06-09T01:27:23Z
Assigned to
andrei
Creator
shro8822

Comments

Comment #0 by shro8822 — 2010-02-08T23:56:21Z
The generic uniform random number generator fails for the "any uint" case by throwing a FP exception. moving either bound in by one fixes the problem. Also, I think there should be a convenience function for that case: T uniform(T)(){ return uniform!("[]",T,T)(T.min,T.max); }
Comment #1 by andrej.mitrovich — 2013-02-04T18:40:16Z
2.039 fails with an integer divide by zero. 2.053+ seems to work fine.