From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: How to create random characters? Date: 14 Dec 2003 13:10:48 +0200 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: Reply-To: Eli Zaretskii NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1071400314 27680 80.91.224.253 (14 Dec 2003 11:11:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 14 Dec 2003 11:11:54 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Dec 14 12:11:51 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 1AVUAB-0008UR-00 for ; Sun, 14 Dec 2003 12:11:51 +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 1AVV71-0006QW-4u for geh-help-gnu-emacs@m.gmane.org; Sun, 14 Dec 2003 07:12:39 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AVV5i-0006HK-0s for help-gnu-emacs@gnu.org; Sun, 14 Dec 2003 07:11:18 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AVV4t-0005fU-ST for help-gnu-emacs@gnu.org; Sun, 14 Dec 2003 07:10:59 -0500 Original-Received: from [207.232.27.5] (helo=WST0054) by monty-python.gnu.org with asmtp (Exim 4.24) id 1AVV4s-0005VM-0L for help-gnu-emacs@gnu.org; Sun, 14 Dec 2003 07:10:26 -0500 Original-To: help-gnu-emacs@gnu.org In-reply-to: (message from Brad Collins on Sun, 14 Dec 2003 16:59:52 +0700) 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:15240 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:15240 > From: Brad Collins > Date: Sun, 14 Dec 2003 16:59:52 +0700 > > I want to generate a random id which is in the format of XXX-0000 > where 'XXX' is made up of ascii characters a-z and 0000 is a random > number 0000-9999. > > I found random -- so that (random 10000) produces the number very > nicely but I can't find anything that will produce three random > characters in the same way. Characters are just small integers, so evaluating the following expression for each of the 3 characters: (+ ?a (random (- ?z ?a))) will give you 3 random numbers between the ASCII code of `a' and that of `z'. Does this solve your problem?