help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: numerical analysis


From: Kevin Rodgers
Subject: Re: numerical analysis
Date: Fri, 30 Jul 2004 11:05:10 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Edward Casey wrote:
> This code fragment produces somewhat pseudo-random powerball numbers:
>
> (progn
> (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?

Why do you (re)set the random number seed more than once?

In what way does the (setq cm ...) form not work?

> 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?

Use find-file-literally or insert-file-contents-literally, then forward-char.

--
Kevin Rodgers



reply via email to

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