1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
6 ;;;; Purpose: Random number functions for KMRCL package
7 ;;;; Programmer: Kevin M. Rosenberg
8 ;;;; Date Started: Apr 2000
10 ;;;; This file, part of KMRCL, is Copyright (c) 2002 by Kevin M. Rosenberg
12 ;;;; KMRCL users are granted the rights to distribute and use this software
13 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
14 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
15 ;;;; *************************************************************************
19 (defun seed-random-generator ()
20 "Evaluate a random number of items"
21 (let ((randfile (make-pathname
22 :directory '(:absolute "dev")
24 (setf *random-state* (make-random-state t))
25 (if (probe-file randfile)
27 (rfs randfile :element-type 'unsigned-byte)
29 ;; ((seed (char-code (read-char rfs))))
30 ((seed (read-byte rfs)))
31 ;;(format t "Randomizing!~%")
33 for item from 1 to seed
35 for it from 0 to (+ (read-byte rfs) 5)
36 do (random 65536))))))))
39 (defmacro random-choice (&rest exprs)
40 `(case (random ,(length exprs))
42 (mapcar #'(lambda (expr)