From f7ec0b90a98c542787715150df27aadde96ea554 Mon Sep 17 00:00:00 2001
From: dtc <dtc>
Date: Sat, 19 Dec 1998 16:10:35 +0000
Subject: [PATCH] Check that the argument to random is positive. Based on
 patches from Peter Van Eynde.

---
 code/rand-mt19937.lisp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/code/rand-mt19937.lisp b/code/rand-mt19937.lisp
index 0039094c6..5a59036fe 100644
--- a/code/rand-mt19937.lisp
+++ b/code/rand-mt19937.lisp
@@ -6,7 +6,7 @@
 ;;; placed in the Public domain, and is provided 'as is'.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/rand-mt19937.lisp,v 1.6 1998/03/21 08:12:04 dtc Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/rand-mt19937.lisp,v 1.7 1998/12/19 16:10:35 dtc Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -300,16 +300,16 @@
   (declare (inline %random-single-float %random-double-float
 		   #+long-float %long-float))
   (cond
-    ((and (fixnump arg) (<= arg random-fixnum-max))
+    ((and (fixnump arg) (<= arg random-fixnum-max) (> arg 0))
      (rem (random-chunk state) arg))
-    ((typep arg 'single-float)
+    ((and (typep arg 'single-float) (> arg 0.0F0))
      (%random-single-float arg state))
-    ((typep arg 'double-float)
+    ((and (typep arg 'double-float) (> arg 0.0D0))
      (%random-double-float arg state))
     #+long-float
-    ((typep arg 'long-float)
+    ((and (typep arg 'long-float) (> arg 0.0L0))
      (%random-long-float arg state))
-    ((integerp arg)
+    ((and (integerp arg) (> arg 0))
      (%random-integer arg state))
     (t
      (error 'simple-type-error
-- 
GitLab