From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/53658 Path: news.gmane.org!not-for-mail From: Taco Hoekwater Newsgroups: gmane.comp.tex.context Subject: Re: Curiosity about math.random in LuaTeX Date: Sun, 25 Oct 2009 09:26:17 +0100 Message-ID: <4AE40BA9.70502@elvenkind.com> References: <3E1D310B-06AE-4B36-B2FF-E60A412A3992@gmail.com> <3cb063a60910231244r441b3e58ud3b013aa4b5f81c4@mail.gmail.com> 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: ger.gmane.org 1256459195 9972 80.91.229.12 (25 Oct 2009 08:26:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Oct 2009 08:26:35 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Oct 25 09:26:28 2009 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.50) id 1N1yQm-0003rT-Bm for gctc-ntg-context-518@m.gmane.org; Sun, 25 Oct 2009 09:26:28 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id A1390C9AC7; Sun, 25 Oct 2009 09:25:23 +0100 (CET) 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 VxTvHFDKTvYw; Sun, 25 Oct 2009 09:25:20 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E1D6CC9AAF; Sun, 25 Oct 2009 09:25:19 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id DBEEDC9AAF for ; Sun, 25 Oct 2009 09:25:17 +0100 (CET) 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 HWPJysGgaSnL for ; Sun, 25 Oct 2009 09:25:14 +0100 (CET) Original-Received: from smtp-vbr9.xs4all.nl (smtp-vbr9.xs4all.nl [194.109.24.29]) by balder.ntg.nl (Postfix) with ESMTP id D082FC9AAA for ; Sun, 25 Oct 2009 09:25:14 +0100 (CET) Original-Received: from [192.168.178.26] (boo.demon.nl [82.161.175.147]) (authenticated bits=0) by smtp-vbr9.xs4all.nl (8.13.8/8.13.8) with ESMTP id n9P8QIJh027506 for ; Sun, 25 Oct 2009 09:26:18 +0100 (CET) (envelope-from taco@elvenkind.com) User-Agent: Thunderbird 2.0.0.21 (X11/20090330) In-Reply-To: <3cb063a60910231244r441b3e58ud3b013aa4b5f81c4@mail.gmail.com> X-Virus-Scanned: by XS4ALL Virus Scanner 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:53658 Archived-At: Otared KAVIAN wrote: > > Indeed I guess that this is due to the random seed used by LuaTeX: is it > possible to force a new random seed upon each typesetting? The randomseed is set by context, and saved between consecutive runs of the same file. Normally, this is what you would want: just imagine what happens if each of the luatex runs in a 'context' call used a different value always. However (this is mostly for Hans), there is a bug in that process: all randomseeds in mkiv appear to be between 0 and 1. Since math.randomseed() expects an integer, this gives almost no randomness at all to the seed values. If you want near-random randomness, you can set the seed yourself based on the return value of os.time(): \ctxlua{math.randomseed(os.time())} Best wishes, Taco ___________________________________________________________________________________ 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 ___________________________________________________________________________________