www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3785] New: std.random.uniform(bound,uint,uint)(uint.min,uint.max) fails.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3785

           Summary: std.random.uniform(bound,uint,uint)(uint.min,uint.max)
                    fails.
           Product: D
           Version: 2.039
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: shro8822 vandals.uidaho.edu


--- Comment #0 from BCS <shro8822 vandals.uidaho.edu> 2010-02-08 23:56:21 PST
---
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); }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 08 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3785


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |andrei metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 08 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3785


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |andrej.mitrovich gmail.com
         Resolution|                            |WORKSFORME


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-02-04
18:40:16 PST ---
2.039 fails with an integer divide by zero.

2.053+ seems to work fine.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 04 2013