From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Edward Casey" Newsgroups: gmane.emacs.help Subject: Re: numerical analysis Date: Fri, 30 Jul 2004 23:31:05 -0500 Organization: Posted via Supernews, http://www.supernews.com Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <10gm847470ovfc5@corp.supernews.com> References: <10gjdus6ip76h85@corp.supernews.com> <410A7FC6.9000808@yahoo.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1091248622 19968 80.91.224.253 (31 Jul 2004 04:37:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 31 Jul 2004 04:37:02 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jul 31 06:36:54 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Bqlc5-0002TV-00 for ; Sat, 31 Jul 2004 06:36:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BqlfL-0001m4-Ml for geh-help-gnu-emacs@m.gmane.org; Sat, 31 Jul 2004 00:40:15 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-02!sn-xit-06!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Original-X-Complaints-To: abuse@supernews.com Original-Lines: 57 Original-Xref: shelby.stanford.edu gnu.emacs.help:124567 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:19902 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:19902 "Kevin Rodgers" wrote in message news:410A7FC6.9000808@yahoo.com... > 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? I just wanted to scramble things up a little more. The interpreter wouldn't allow it within the loop so I called it afterwards. Apparently it seeds random with a value determined by a combination of transient hardware states. > > In what way does the (setq cm ...) form not work? The (progn form does return a list of 6 pseudo-random numbers but the commented ;; (setq cm (+ (mod.... [goes with following line that wordwrapped] apparently didn't work for the same reason that (random t) didn't, viz. it interrogated the hardware within a loop. > > > 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. Thanks for that. I am still buried under the avalanche of all this new stuff to learn. > > -- > Kevin Rodgers >