aboutsummaryrefslogtreecommitdiffstats
path: root/random.scm
diff options
context:
space:
mode:
authorThomas Bushnell, BSG <tb@debian.org>2008-02-04 20:29:13 -0500
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:41 -0800
commit71dab84adaa579f9386dd8ee09006d3cac625723 (patch)
tree8022514642d25edffdb4bdd130020674b0efd844 /random.scm
parent897451458bd8eec628c7bbfaccba0dd069830f0f (diff)
parent4684239efa63dc1b2c1cbe37ef7d3062029f5532 (diff)
downloadslib-71dab84adaa579f9386dd8ee09006d3cac625723.tar.gz
slib-71dab84adaa579f9386dd8ee09006d3cac625723.zip
Import Debian changes 3b1-1debian/3b1-1
slib (3b1-1) unstable; urgency=low * New upstream release. * guile.init (library-vicinity): Repeat change from 3a4-2. * slib.texi (Library Catalogs): Repeat change from 3a3-3. * slib.sh: Repeat change from 3a5-3. * slib.1: Repeat change from 3a5-4. * Makefile: Repeat change from 3a2-1.
Diffstat (limited to 'random.scm')
-rw-r--r--random.scm12
1 files changed, 7 insertions, 5 deletions
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