Skip to content

Commit

Permalink
range needs to be [from .. (to - 1)] not [0 .. (to - from + 1)]
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.parrot.org/parrot/trunk@44470 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
mikehh committed Feb 25, 2010
1 parent 468083c commit a7a6d6f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ Parrot_range_rand(INTVAL from, INTVAL to, INTVAL how_random)
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
Expand Down

0 comments on commit a7a6d6f

Please sign in to comment.