From: Chris Hanson Date: Mon, 9 Aug 1999 19:33:44 +0000 (+0000) Subject: Tweak /dev/random loop to be a little cleaner. X-Git-Tag: 20090517-FFI~4485 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=e7521a939621d52a870cd0be4fc863c6745cef49;p=mit-scheme.git Tweak /dev/random loop to be a little cleaner. --- diff --git a/v7/src/runtime/random.scm b/v7/src/runtime/random.scm index 1abd81963..967f31c1b 100644 --- a/v7/src/runtime/random.scm +++ b/v7/src/runtime/random.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: random.scm,v 14.21 1999/08/09 19:30:18 cph Exp $ +$Id: random.scm,v 14.22 1999/08/09 19:33:44 cph Exp $ Copyright (c) 1993-1999 Massachusetts Institute of Technology @@ -96,19 +96,16 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. (lambda (port) (initial-random-state (lambda (b) - (let loop () - (let ((n - (let loop - ((m #x100) - (n (char->integer (read-char port)))) - (if (< m b) - (loop (* m #x100) - (+ (* n #x100) - (char->integer (read-char port)))) - n)))) - (if (< n b) - n - (loop)))))))) + (let outer () + (let inner + ((m #x100) + (n (char->integer (read-char port)))) + (cond ((< m b) + (inner (* m #x100) + (+ (* n #x100) + (char->integer (read-char port))))) + ((< n b) n) + (else (outer))))))))) (initial-random-state (congruential-rng (+ (real-time-clock) 123456789)))) (copy-random-state