[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

numerical analysis

From: Edward Casey
Subject: numerical analysis
Date: Thu, 29 Jul 2004 21:52:15 -0500

This code fragment produces somewhat pseudo-random powerball numbers:

(random t)
(setq lis6 nil)
(while (< (length lis6) 5)
     ;; (setq cm (+ (mod (* (nth 1 (current-time))(/ (nth 2
(current-time)) 10000)(random)) 52) 1))
     ;; (random t)
      (setq cm (+ (random 52) 1))
      (if (not (member cm lis6)) (setq lis6 (cons cm lis6)))
(setq lis6 (sort lis6 '>))
(random t)
(setq cm (+ (random 41) 1))
(setq lis6 (cons cm lis6))
(reverse lis6)

The commented-out lines don't seem to work in a loop. Is there some way I
could mix this up some more to get closer to true randomness? In emacs
lisp is it possible to open an arbitrary file (say a compressed graphic
file of white noise) and to advance the file pointer by 8-bit increments?

Thanks in advance for any help.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]