From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Harald Maier Newsgroups: gmane.emacs.help Subject: Re: How to create random characters? Date: Thu, 18 Dec 2003 19:30:50 +0100 Organization: 1&1 Internet AG Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <878ylawh4d.fsf@emptyhost.emptydomain.de> Reply-To: Harald Maier NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1071773255 7184 80.91.224.253 (18 Dec 2003 18:47:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 18 Dec 2003 18:47:35 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 18 19:47:32 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AX3BM-0003Fz-00 for ; Thu, 18 Dec 2003 19:47:32 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AX47e-0002EE-Pv for geh-help-gnu-emacs@m.gmane.org; Thu, 18 Dec 2003 14:47:46 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!news.uni-stuttgart.de!rz.uni-karlsruhe.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 34 Original-NNTP-Posting-Host: p5088ea8b.dip0.t-ipconnect.de Original-X-Trace: online.de 1071772250 18430 80.136.234.139 (18 Dec 2003 18:30:50 GMT) Original-X-Complaints-To: abuse@einsundeins.com Original-NNTP-Posting-Date: Thu, 18 Dec 2003 18:30:50 +0000 (UTC) User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:0adZ95wtGdxpi1/eWerONDWfdS4= Original-Xref: shelby.stanford.edu gnu.emacs.help:119492 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 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:15431 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:15431 Brad Collins writes: > Kai Grossjohann writes: > ,----[ Elisp Manual: Random Numbers ] > | In Emacs, pseudo-random numbers are generated from a "seed" number. > | Starting from any given seed, the `random' function always generates > | the same sequence of numbers. Emacs always starts with the same seed > | value, so the sequence of values of `random' is actually the same in > | each Emacs run! For example, in one operating system, the first call > | to `(random)' after you start Emacs always returns -1457731, and the > | second one always returns -7692030. This repeatability is helpful for > | debugging. > | > | If you want random numbers that don't always come out the same, > | execute `(random t)'. This chooses a new seed based on the current > | time of day and on Emacs's process ID number. > `---- > > When I evaluated (random t) > > I got 80264346 > > But I need to get a single digit between 0-9 so I used (random 9) > > But this then uses the same seed every time so the sequence of > numbers I'm returned will be repeated every time I restart Emacs. Then you have not called again the seed function of random (random t). I am using the elisp random function all the time to hear music from my music library in a random fashion. And I do not get always the same songs. They are always different. Harald