From 4684239efa63dc1b2c1cbe37ef7d3062029f5532 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 20 Feb 2017 00:05:40 -0800 Subject: Import Upstream version 3b1 --- random.scm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'random.scm') diff --git a/random.scm b/random.scm index a6259f6..f4b2abb 100644 --- a/random.scm +++ b/random.scm @@ -64,13 +64,15 @@ (do ((bln bitlen (+ -8 bln)) (rbs 0 (+ (arithmetic-shift rbs 8) (random:chunk state)))) ((<= bln 7) - (if (positive? bln) - (set! rbs (logxor (arithmetic-shift rbs bln) - (random:chunk state)))) - (if (< rbs modu) rbs (rnd))))) + (cond ((positive? bln) + (set! rbs (logxor (arithmetic-shift rbs bln) + (random:chunk state))) + (if (>= rbs modu) (rnd) rbs)) + ((>= rbs modu 1) (rnd)) + ((positive? modu) rbs) + (else (slib:error 'random 'not 'positive? modu)))))) (rnd)) - ;;@defvar *random-state* ;;Holds a data structure that encodes the internal state of the ;;random-number generator that @code{random} uses by default. The nature -- cgit v1.2.3