Changeset 13322 for branches/new-random


Ignore:
Timestamp:
Dec 22, 2009, 5:07:01 AM (10 years ago)
Author:
rme
Message:

Remove obsolete functions %cons-random-state and initialize-random-state.
Assume that all targets use the new random state objects.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/new-random/level-1/l1-numbers.lisp

    r13313 r13322  
    422422      nil)))
    423423
    424 #-x86-target
    425 (defun %cons-random-state (seed-1 seed-2)
    426   #+32-bit-target
    427   (%istruct 'random-state seed-1 seed-2)
    428   #+64-bit-target
    429   (%istruct 'random-state (the fixnum (+ (the fixnum seed-2)
    430                           (the fixnum (ash (the fixnum seed-1) 16))))))
    431 
    432424;;; random associated stuff except for the print-object method which
    433425;;; is still in "lib;numbers.lisp"
    434 #-x86-target
    435 (defun initialize-random-state (seed-1 seed-2)
    436   (unless (and (fixnump seed-1) (%i<= 0 seed-1) (%i< seed-1 #x10000))
    437     (report-bad-arg seed-1 '(unsigned-byte 16)))
    438   (unless (and (fixnump seed-2) (%i<= 0 seed-2) (%i< seed-2 #x10000))
    439     (report-bad-arg seed-2 '(unsigned-byte 16)))
    440     (%cons-random-state seed-1 seed-2))
    441426
    442427(defun init-random-state-seeds ()
     
    481466
    482467(defun initial-random-state ()
    483   #-x86-target
    484   (initialize-random-state #xFBF1 9)
    485   #+x86-target
    486468  (initialize-mrg31k3p-state 12345 12345 12345 12345 12345 12345))
    487469
    488 #-x86-target
    489 (defun make-random-state (&optional state)
    490   "Make a new random state object. If STATE is not supplied, return a
    491   copy of the default random state. If STATE is a random state, then
    492   return a copy of it. If STATE is T then return a randomly
    493   initialized random state."
    494   (let* ((seed-1 0)
    495          (seed-2 0))
    496     (if (eq state t)
    497       (multiple-value-setq (seed-1 seed-2) (init-random-state-seeds))
    498       (progn
    499         (setq state (require-type (or state *random-state*) 'random-state))
    500         #+32-bit-target
    501         (setq seed-1 (random.seed-1 state) seed-2 (random.seed-2 state))
    502         #+64-bit-target
    503         (let* ((seed (random.seed-1 state)))
    504           (declare (type (unsigned-byte 32) seed))
    505           (setq seed-1 (ldb (byte 16 16) seed)
    506                 seed-2 (ldb (byte 16 0) seed)))))
    507     (%cons-random-state seed-1 seed-2)))
    508 
    509 #+x86-target
    510470(defun make-random-state (&optional state)
    511471  "Make a new random state object. If STATE is not supplied, return a
     
    524484(defun %random-state-equalp (x y)
    525485  ;; x and y are both random-state objects
    526   #-x86-target
    527   (and (= (random.seed-1 x) (random.seed-1 y))
    528        #+32-bit-target
    529        (= (random.seed-2 x) (random.seed-2 y)))
    530   #+x86-target
    531486  (equalp (random.mrg31k3p-state x) (random.mrg31k3p-state y)))
    532487
Note: See TracChangeset for help on using the changeset viewer.