Changeset 13333
- Timestamp:
- Dec 22, 2009, 2:35:55 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/source/level-1/l1-numbers.lisp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/level-1/l1-numbers.lisp
r13327 r13333 457 457 458 458 (defun random-mrg31k3p-state () 459 (loop repeat 6 460 for n = (init-random-state-seeds) 461 ;; The first three seed elements must not be all zero, and 462 ;; likewise for the second three. Avoid the issue by 463 ;; excluding zero values. 464 collect (1+ (mod n (1- mrg31k3p-limit))) into seed 465 finally (return (apply #'%cons-mrg31k3p-state seed)))) 459 (with-open-file (stream "/dev/urandom" :element-type '(unsigned-byte 32) 460 :if-does-not-exist nil) 461 (loop repeat 6 462 for n = (if stream (read-byte stream) (init-random-state-seeds)) 463 ;; The first three seed elements must not be all zero, and 464 ;; likewise for the second three. Avoid the issue by 465 ;; excluding zero values. 466 collect (1+ (mod n (1- mrg31k3p-limit))) into seed 467 finally (return (apply #'%cons-mrg31k3p-state seed))))) 466 468 467 469 (defun initial-random-state () 468 (initialize-mrg31k3p-state 12345 12345 12345 12345 12345 12345))470 (initialize-mrg31k3p-state 314159 42 1776 271828 6021023 1066)) 469 471 470 472 (defun make-random-state (&optional state)
Note:
See TracChangeset
for help on using the changeset viewer.
