From 7e805107559be1e42fac1d793edbf063741b56b3 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sat, 25 Apr 2015 13:05:17 +0900 Subject: [PATCH] Fixing typo in random-integer fix. --- lib/srfi/27/rand.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/srfi/27/rand.c b/lib/srfi/27/rand.c index 11631bf4..13d4cc4d 100644 --- a/lib/srfi/27/rand.c +++ b/lib/srfi/27/rand.c @@ -69,12 +69,12 @@ static sexp sexp_rs_random_integer (sexp ctx, sexp self, sexp_sint_t n, sexp rs, } /* Scan down, modding bigits > bound to < bound, and stop as */ /* soon as we are sure the result is within bound. */ - for (i = hi-1; i >= 0; i++) { - mod = sexp_bignum_data(bound)[i-1]; - if (mod && sexp_bignum_data(res)[i-1] > mod) { - sexp_bignum_data(res)[i-1] %= mod; + for (i = hi-1; i >= 0; i--) { + mod = sexp_bignum_data(bound)[i]; + if (mod && sexp_bignum_data(res)[i] > mod) { + sexp_bignum_data(res)[i] %= mod; } - if (sexp_bignum_data(res)[i-1] != mod) { + if (sexp_bignum_data(res)[i] != mod) { break; } }