From 576bc9b8fee8387b173cc728b6e22321c82413ed Mon Sep 17 00:00:00 2001 From: Marco Baringer Date: Fri, 20 Jan 2006 18:26:25 +0100 Subject: [PATCH] Added :alphanumericp keyword to gen-character --- src/random.lisp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/random.lisp b/src/random.lisp index 0f66f84..6cf070d 100644 --- a/src/random.lisp +++ b/src/random.lisp @@ -120,8 +120,14 @@ returning true. This second run limit prevents that.") (min (1+ most-negative-fixnum))) (+ min (random (1+ (- max min))))) -(defgenerator gen-character (&key (code (gen-integer :min 0 :max (1- char-code-limit)))) - (code-char (funcall code))) +(defgenerator gen-character (&key (code (gen-integer :min 0 :max (1- char-code-limit))) + (alphanumericp nil)) + (if alphanumericp + (code-char (funcall code)) + (loop + for char = (code-char (funcall code)) + until (alphanumericp char) + finally (return char)))) (defun gen-string (&key (length (gen-integer :min 0 :max 80)) -- 1.7.10.4