;;; -*- mode: lisp -*- ;;; $Id: random.poplisp,v 1.0 2002/05/08 17:32:00 dada Exp $ (defconstant IM 139968) (defconstant IA 3877) (defconstant IC 29573) (defvar LAST 42) (declaim (inline gen_random)) (defun gen_random (max) (declare (type (signed-byte 32) IM IA IC LAST)) (declare (double-float max)) (setq LAST (mod (+ (the fixnum (* LAST IA)) IC) IM)) (/ (* max LAST) IM)) (let ((n (parse-integer (or (car pop11::poparglist) "1")))) (loop for i fixnum from 1 below n do (gen_random 100.0d0)) (format t "~,9K~%" (gen_random 100.0d0)))