Created
March 2, 2009 15:42
-
-
Save g000001/72812 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun rands () | |
(list (random 100 #.*random-state*) | |
(random 100 #.*random-state*) | |
(random 100 #.*random-state*))) | |
;; ccl: 毎回違う | |
(list (rands) (rands) (rands)) | |
;; ccl: 毎回同じ結果 | |
;; sbcl: 毎回違う | |
(defun rands1 () | |
(list (random 100 *random-state*) | |
(random 100 *random-state*) | |
(random 100 *random-state*))) | |
(list (rands1) (rands1) (rands1)) ;=> (91 6 55) | |
(defun rands2 () | |
(let ((rs (make-random-state T))) | |
(list (random 100 rs) | |
(random 100 rs) | |
(random 100 rs)))) | |
;; ccl: 毎回違う | |
;; sbcl 連続で同じで次のパターンへ | |
(list (rands2) (rands2) (rands2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment