[svn:parrot] r44470 - trunk/src

mikehh at svn.parrot.org mikehh at svn.parrot.org
Thu Feb 25 05:21:30 UTC 2010


Author: mikehh
Date: Thu Feb 25 05:21:30 2010
New Revision: 44470
URL: https://trac.parrot.org/parrot/changeset/44470

Log:
range needs to be [from .. (to  - 1)] not [0 .. (to - from + 1)]

Modified:
   trunk/src/utils.c

Modified: trunk/src/utils.c
==============================================================================
--- trunk/src/utils.c	Thu Feb 25 04:18:47 2010	(r44469)
+++ trunk/src/utils.c	Thu Feb 25 05:21:30 2010	(r44470)
@@ -494,7 +494,7 @@
     ASSERT_ARGS(Parrot_range_rand)
     const double spread = (double)(to - from + 1);
     const double randpart = Parrot_float_rand(how_random);
-    INTVAL raw = (INTVAL)(spread * randpart);
+    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


More information about the parrot-commits mailing list