/[emacs]/emacs/lisp/calc/calc-comb.el
ViewVC logotype

Diff of /emacs/lisp/calc/calc-comb.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by jpb, Thu Dec 16 22:56:08 2004 UTC revision 1.10 by jpb, Fri Dec 17 05:26:18 2004 UTC
# Line 540  Line 540 
540  ;;; Produce a random 10-bit integer, with (random) if no seed provided,  ;;; Produce a random 10-bit integer, with (random) if no seed provided,
541  ;;; or else with Numerical Recipes algorithm ran3 / Knuth 3.2.2-A.  ;;; or else with Numerical Recipes algorithm ran3 / Knuth 3.2.2-A.
542    
543  (defvar var-RandSeed nil)  (defvar var-RandSeed)
544  (defvar math-random-cache nil)  (defvar math-random-cache nil)
545  (defvar math-gaussian-cache nil)  (defvar math-gaussian-cache nil)
546    
547  (defun math-init-random-base ()  (defun math-init-random-base ()
548    (if var-RandSeed    (if (and (boundp 'var-RandSeed) var-RandSeed)
549        (if (eq (car-safe var-RandSeed) 'vec)        (if (eq (car-safe var-RandSeed) 'vec)
550            nil            nil
551          (if (Math-integerp var-RandSeed)          (if (Math-integerp var-RandSeed)
# Line 599  Line 599 
599  ;;; Produce a random digit in the range 0..999.  ;;; Produce a random digit in the range 0..999.
600  ;;; Avoid various pitfalls that may lurk in the built-in (random) function!  ;;; Avoid various pitfalls that may lurk in the built-in (random) function!
601  ;;; Shuffling algorithm from Numerical Recipes, section 7.1.  ;;; Shuffling algorithm from Numerical Recipes, section 7.1.
602    (defvar math-random-last)
603  (defun math-random-digit ()  (defun math-random-digit ()
604    (let (i math-random-last)    (let (i)
605      (or (and var-RandSeed (eq var-RandSeed math-last-RandSeed))      (or (and (boundp 'var-RandSeed) (eq var-RandSeed math-last-RandSeed))
606          (math-init-random-base))          (math-init-random-base))
607      (or math-random-cache      (or math-random-cache
608          (progn          (progn

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26