[Issue 5240] Faster std.random.uniform() for [0.0, 1.0) range
https://d.puremagic.com/issues/show_bug.cgi?id=5240 --- Comment #7 from github-bugzi...@puremagic.com 2014-04-02 23:34:23 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/d0727dc7a02a33d855cc141f09f883501077797b Fix Issue #5240: faster std.random.uniform for [0.0, 1.0) range Following typical design in other languages, the function is named uniform01. It can be templated on floating-point type, defaulting to double if none is specified. The implementation is pretty much derived from its counterpart in Boost.Random, in particular in its taking account of the different requirements for integral versus floating-point RNG values, and in checking that the generated variate is less than 1 before returning. This last check is necessary simply because we can't guarantee, in the case of a floating-point based RNG, that we will not get a result exactly equal to 1. Fixes http://d.puremagic.com/issues/show_bug.cgi?id=5240 https://github.com/D-Programming-Language/phobos/commit/0ba2004bd4d725c5ccff227a65bc19a6e3371381 Merge pull request #2050 from WebDrake/uniform01 Fix Issue #5240: faster std.random.uniform for [0.0, 1.0) range -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5240] Faster std.random.uniform() for [0.0, 1.0) range
https://d.puremagic.com/issues/show_bug.cgi?id=5240 bearophile_h...@eml.cc changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5240] Faster std.random.uniform() for [0.0, 1.0) range
http://d.puremagic.com/issues/show_bug.cgi?id=5240 Andrei Alexandrescu and...@metalanguage.com changed: What|Removed |Added Status|NEW |ASSIGNED CC||and...@metalanguage.com AssignedTo|nob...@puremagic.com|and...@metalanguage.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5240] Faster std.random.uniform() for [0.0, 1.0) range
http://d.puremagic.com/issues/show_bug.cgi?id=5240 --- Comment #4 from bearophile_h...@eml.cc 2010-11-22 09:44:33 PST --- (In reply to comment #3) I am probably missing something, but what is wrong with uniform!(0,1) ? Then you can add optimizations for all the special cases you want. Currently uniform() uses run-time arguments, not template ones. -- See also: http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.Darticle_id=122634 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5240] Faster std.random.uniform() for [0.0, 1.0) range
http://d.puremagic.com/issues/show_bug.cgi?id=5240 --- Comment #6 from bearophile_h...@eml.cc 2010-11-22 12:05:44 PST --- (In reply to comment #5) I was commenting on the suggested name uniform01. Templating the function seemed obvious to me and I was also surprised you didn't suggest doing that so I thought I was missing something there. I don't like the idea of a templated ranged uniform. In most cases is not what I need or what's better. As for speed, as tn mentioned on the newsgroup, subnormal numbers considerately slow down calculations. It's in the link of Comment 4 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5240] Faster std.random.uniform() for [0.0, 1.0) range
http://d.puremagic.com/issues/show_bug.cgi?id=5240 Denis Derman denis.s...@gmail.com changed: What|Removed |Added CC||denis.s...@gmail.com --- Comment #2 from Denis Derman denis.s...@gmail.com 2010-11-21 00:55:34 PST --- I would vote for uniform01(). Having it called random() would implicitely promote to the default random function, from which all other forms of random would/should be computed. Denis -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5240] Faster std.random.uniform() for [0.0, 1.0) range
http://d.puremagic.com/issues/show_bug.cgi?id=5240 st...@despam.it changed: What|Removed |Added CC||st...@despam.it --- Comment #3 from st...@despam.it 2010-11-21 05:17:43 PST --- I am probably missing something, but what is wrong with uniform!(0,1) ? Then you can add optimizations for all the special cases you want. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 5240] Faster std.random.uniform() for [0.0, 1.0) range
http://d.puremagic.com/issues/show_bug.cgi?id=5240 --- Comment #1 from bearophile_h...@eml.cc 2010-11-19 12:10:42 PST --- A specialized overload/function like this is useful in Phobos even if it's not faster. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---