From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/57930 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: randomize Date: Tue, 6 Apr 2010 23:05:05 -0400 (EDT) Message-ID: References: <4BBA7EA0.8953.1FE26F0@wwl.musensturm.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1270609517 15255 80.91.229.12 (7 Apr 2010 03:05:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 7 Apr 2010 03:05:17 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Apr 07 05:05:16 2010 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NzLZs-0004Rs-2P for gctc-ntg-context-518@m.gmane.org; Wed, 07 Apr 2010 05:05:16 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id DCCAFC9D2A; Wed, 7 Apr 2010 05:05:15 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id i5s8x4aSwguW; Wed, 7 Apr 2010 05:05:15 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id BD462C9D21; Wed, 7 Apr 2010 05:05:12 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 2A160C9D21 for ; Wed, 7 Apr 2010 05:05:11 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id rAjO0FRFFamW for ; Wed, 7 Apr 2010 05:05:08 +0200 (CEST) Original-Received: from hackers.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.14.81]) by balder.ntg.nl (Postfix) with ESMTP id 2F42DC9D10 for ; Wed, 7 Apr 2010 05:05:08 +0200 (CEST) Original-Received: FROM [192.168.2.8] (c-76-28-91-31.hsd1.ct.comcast.net [76.28.91.31]) By hackers.mr.itd.umich.edu ID 4BBBF662.B339A.5434 ; Authuser adityam; 6 Apr 2010 23:05:06 EDT In-Reply-To: <4BBA7EA0.8953.1FE26F0@wwl.musensturm.de> User-Agent: Alpine 2.01 (LNX 1266 2009-07-14) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:57930 Archived-At: On Tue, 6 Apr 2010, Wolfgang Werners-Lucchini wrote: > Hallo, > > I get allways (10 times at least) the same result: > ------------------------------------------------------------- > \starttext > \startluacode > math.randomseed(os.time()) > \stopluacode > > Encode your Name and Surname as a > \startluacode > local a = {'null-terminated', 'dollar-terminated', 'Pascal'} > context('%s string', a[math.random(1,3)]) > \stopluacode > \stoptext > ------------------------------------------------------------- > How can I randomize this? Hmm... which version are you using? I do get a ranom output each time. Tested with 2009.12.31 and 2010.03.20. Since the math seed is set after \starttext, it should overwrite the value after reading the tuc file. Actually, I consider saving the random number in tuc file to be a misfeature. A random sequence generator should generate a random sequence. If I want the same behavior all the time, I can use \setupsystem[random=12345] (which should also set math.randomseed). Aditya ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________