digitalmars.D.bugs - [Issue 2921] New: std.random.uniform doesn't work with char.
- d-bugmail puremagic.com (21/21) May 02 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2921
- d-bugmail puremagic.com (9/9) May 03 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2921
- d-bugmail puremagic.com (9/9) May 03 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2921
http://d.puremagic.com/issues/show_bug.cgi?id=2921 Summary: std.random.uniform doesn't work with char. Product: D Version: 2.029 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: bugzilla digitalmars.com ReportedBy: dsimcha yahoo.com import std.random, std.stdio; void main() { foreach(i; 0..1_000) { write(uniform!"[]"('A', 'Z')); } } Prints: All A's. If 'A' and 'Z' are cast to ubyte, the results look reasonable. --
May 02 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2921 Created an attachment (id=346) --> (http://d.puremagic.com/issues/attachment.cgi?id=346&action=view) Make uniform work with chars. It's just a problem of uniform trying to treat characters as if they were floating point types because isIntegral!(char) is false. Here's a patch that just makes a new template isIntOrChar(T) and uses that instead. --
May 03 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2921 andrei metalanguage.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Thanks, fixed in svn. --
May 03 2009