|
@@ -1,5 +1,3 @@
|
|
|
-(quickload :secure-random)
|
|
|
-
|
|
|
(defvar *first-column*
|
|
|
'("Temporary" "Intermittant" "Partial" "Redundant" "Total" "Multiplexed"
|
|
|
"Inherent" "Duplicated" "Dual-Homed" "Synchronous" "Bidirectional"
|
|
@@ -38,19 +36,34 @@
|
|
|
|
|
|
(defvar *fourth-length* (length *optional-fourth-column*))
|
|
|
|
|
|
+(defvar *initialized-p* nil)
|
|
|
+
|
|
|
(defun ensure-positive (number)
|
|
|
(if (< number 0)
|
|
|
(- number)
|
|
|
number))
|
|
|
|
|
|
-(dotimes (number (ensure-positive (secure-random:number 100)))
|
|
|
- (dotimes (other (ensure-positive (secure-random:number (1+ number))))
|
|
|
- (dotimes (yet-another (ensure-positive (secure-random:number (1+ other))))
|
|
|
- (ensure-positive (secure-random:number (1+ yet-another))))))
|
|
|
+(defun ensure-initialized ()
|
|
|
+ (when (not *initialized-p*)
|
|
|
+ (setq *random-state* (make-random-state t)
|
|
|
+ *initialized-p* t)
|
|
|
+ (dotimes (number (ensure-positive (random 100)))
|
|
|
+ (dotimes (other (ensure-positive (random (1+ number))))
|
|
|
+ (dotimes (yet-another (ensure-positive (random (1+ other))))
|
|
|
+ (ensure-positive (random (1+ yet-another))))))))
|
|
|
+
|
|
|
+(defun get-excuse (stream)
|
|
|
+ (ensure-initialized)
|
|
|
+ (let ((first-word (nth (ensure-positive (1- (random *first-length*))) *first-column*))
|
|
|
+ (second-word (nth (ensure-positive (1- (random *second-length*))) *second-column*))
|
|
|
+ (third-word (nth (ensure-positive (1- (random *third-length*))) *third-column*))
|
|
|
+ (fourth-word (nth (ensure-positive (1- (random *fourth-length*))) *optional-fourth-column*)))
|
|
|
+ (format stream "~a ~a ~a (~a)~%" first-word second-word third-word fourth-word)))
|
|
|
|
|
|
(defun main ()
|
|
|
- (let ((first-word (nth (ensure-positive (1- (secure-random:number *first-length*))) *first-column*))
|
|
|
- (second-word (nth (ensure-positive (1- (secure-random:number *second-length*))) *second-column*))
|
|
|
- (third-word (nth (ensure-positive (1- (secure-random:number *third-length*))) *third-column*))
|
|
|
- (fourth-word (nth (ensure-positive (1- (secure-random:number *fourth-length*))) *optional-fourth-column*)))
|
|
|
- (format t "~a ~a ~a (~a)~%" first-word second-word third-word fourth-word)))
|
|
|
+ (let ((count (if (not (null (second *posix-argv*)))
|
|
|
+ (parse-integer (second *posix-argv*) :junk-allowed t)
|
|
|
+ 1)))
|
|
|
+ (dotimes (n count)
|
|
|
+ (declare (ignorable n))
|
|
|
+ (get-excuse *standard-output*))))
|