[svn:parrot] r44471 - trunk/src
mikehh at svn.parrot.org
mikehh at svn.parrot.org
Thu Feb 25 07:29:34 UTC 2010
Author: mikehh
Date: Thu Feb 25 07:29:33 2010
New Revision: 44471
URL: https://trac.parrot.org/parrot/changeset/44471
Log:
the range must be [from .. to] inclusive - the removed test would double up on (to - 1)
Modified:
trunk/src/utils.c
Modified: trunk/src/utils.c
==============================================================================
--- trunk/src/utils.c Thu Feb 25 05:21:30 2010 (r44470)
+++ trunk/src/utils.c Thu Feb 25 07:29:33 2010 (r44471)
@@ -494,13 +494,8 @@
ASSERT_ARGS(Parrot_range_rand)
const double spread = (double)(to - from + 1);
const double randpart = Parrot_float_rand(how_random);
- INTVAL raw = from + (INTVAL)(spread * randpart);
+ const INTVAL raw = from + (INTVAL)(spread * randpart);
- /* This shouldn't be necessary since Parrot_float_rand is supposed to
- return a value between [0.0, 1.0), but let's just try to avoid the
- unlikely fencepost errors anyway. */
- if (raw == to)
- raw--;
return raw;
}
More information about the parrot-commits
mailing list