diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:40 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:40 -0800 |
commit | 4684239efa63dc1b2c1cbe37ef7d3062029f5532 (patch) | |
tree | 606a687e9279e9bf6048925878968df9875a4973 /random.scm | |
parent | 64f037d91e0c9296dcaef9a0ff3eb33b19a2ed34 (diff) | |
download | slib-4684239efa63dc1b2c1cbe37ef7d3062029f5532.tar.gz slib-4684239efa63dc1b2c1cbe37ef7d3062029f5532.zip |
Import Upstream version 3b1upstream/3b1
Diffstat (limited to 'random.scm')
-rw-r--r-- | random.scm | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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 |