[phobos] [D-Programming-Language/phobos] d0727d: Fix Issue #5240: faster std.random.uniform for [0....

GitHub noreply at github.com
Wed Apr 2 23:34:07 PDT 2014


  Branch: refs/heads/master
  Home:   https://github.com/D-Programming-Language/phobos
  Commit: d0727dc7a02a33d855cc141f09f883501077797b
      https://github.com/D-Programming-Language/phobos/commit/d0727dc7a02a33d855cc141f09f883501077797b
  Author: Joseph Rushton Wakeling <joe at webdrake.net>
  Date:   2014-03-25 (Tue, 25 Mar 2014)

  Changed paths:
    M std/random.d

  Log Message:
  -----------
  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


  Commit: 93fe844b729f86fb5a546e1a0ef5213a198242bf
      https://github.com/D-Programming-Language/phobos/commit/93fe844b729f86fb5a546e1a0ef5213a198242bf
  Author: Joseph Rushton Wakeling <joe at webdrake.net>
  Date:   2014-03-27 (Thu, 27 Mar 2014)

  Changed paths:
    M std/random.d

  Log Message:
  -----------
  Small optimization to uniform01

Only need to chech u < 1 if RNG returns non-integral variates.


  Commit: 0ba2004bd4d725c5ccff227a65bc19a6e3371381
      https://github.com/D-Programming-Language/phobos/commit/0ba2004bd4d725c5ccff227a65bc19a6e3371381
  Author: monarch dodra <monarchdodra at gmail.com>
  Date:   2014-04-03 (Thu, 03 Apr 2014)

  Changed paths:
    M std/random.d

  Log Message:
  -----------
  Merge pull request #2050 from WebDrake/uniform01

Fix Issue #5240: faster std.random.uniform for [0.0, 1.0) range


Compare: https://github.com/D-Programming-Language/phobos/compare/920ec004b422...0ba2004bd4d7


More information about the phobos mailing list