Thread overview | |||||
---|---|---|---|---|---|
|
May 25, 2009 [Issue 3025] New: uniform(float,float) pops first, uniform(int,int) pops last | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=3025 Summary: uniform(float,float) pops first, uniform(int,int) pops last Product: D Version: 2.030 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: bugzilla@digitalmars.com ReportedBy: lio+bugzilla@lunesu.com I noticed in random.d, uniform template, that popFront is called in different locations for integral compared to floating point types: for integral types you .front first and .popFront afterwards, but for floating point types you start with .popFront and then check .front. This has a peculiar effect: for example, if you do uniform(0.0,100.0) followed by uniform(0,100) there's a big chance that the integral part of the first random number is equal to the second random number. import std.stdio, std.random; void main() { writeln(uniform(0.0,100.0)); writeln(uniform(0,100)); } The location of .popFront should be standardized, either before or after any .front. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 25, 2009 [Issue 3025] uniform(float,float) pops first, uniform(int,int) pops last | ||||
---|---|---|---|---|
| ||||
Posted in reply to lio+bugzilla@lunesu.com | http://d.puremagic.com/issues/show_bug.cgi?id=3025 Andrei Alexandrescu <andrei@metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |andrei@metalanguage.com AssignedTo|bugzilla@digitalmars.com |andrei@metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 28, 2009 [Issue 3025] uniform(float,float) pops first, uniform(int,int) pops last | ||||
---|---|---|---|---|
| ||||
Posted in reply to lio+bugzilla@lunesu.com | http://d.puremagic.com/issues/show_bug.cgi?id=3025 Andrei Alexandrescu <andrei@metalanguage.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #1 from Andrei Alexandrescu <andrei@metalanguage.com> 2009-08-27 22:23:09 PDT --- I always call popFront at the end now. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation