这是代码:
(defun my-random (max &optional least)
(setf max (+ max 1))
(if (null least)
(random max)
(if (numberp least)
(if (numberp max)
(let ((x (random (- max least))))
(+ x least))
(format t "~%?my-random???????: ????????????!~%"))
(format t "~%?my-random???????: ????????????!~%"))))
Run Code Online (Sandbox Code Playgroud)
;我的随机100 1
(defun prozentual (probability command)
(if (numberp probability)
(if (listp command)
(if (> 101 probability)
(if (> probability (my-random 101 1))
command)
(format t "~%?prozentual???????: ??????100!~%))
(format t "~%?prozentual???????: ???????????!~%))
(format t "~%?prozentual???????: ???????????!~%)))
Run Code Online (Sandbox Code Playgroud)
; prozentual 100(格式为"as")
This is the …
Run Code Online (Sandbox Code Playgroud)