;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This file is part of ICCLE2. ; ; ICCLE2 is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version. ; ; ICCLE2 is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with ICCLE2. If not, see . ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defstruct fixed-App "fixed stuff" ) (defstruct wm-App "runtime working memory" ) (defparameter *w4App* (make-wm-App)) (defparameter *f4App* (make-fixed-App)) (defun zap-App () (setf *w4App* (make-wm-App))) (defparameter *seed0* 10013) (defparameter *seed* *seed0*) (defun reset-seed () (setf *seed* *seed0*)) (defun park-miller-randomizer () (let ((multiplier 16807.0d0);16807 is (expt 7 5) (modulus 2147483647.0d0)) ;2147483647 is (- (expt 2 31) 1) (let ((temp (* multiplier *seed*))) (setf *seed* (mod temp modulus)) (/ *seed* modulus)))) (defun my-random (n) (let ((random-number (park-miller-randomizer))) (* n (- 1.0d0 random-number)))) (defun my-random-int (n) (let ((random-number (/ (my-random 1000.0) 1000))) (floor (* n random-number)))) (defun random-between-int (l u) (let ((ul-diff (- (floor u) (ceiling l)))) (+ (my-random-int (+ 1 ul-diff)) (ceiling l)) ) )