From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/53702 Path: news.gmane.org!not-for-mail From: Otared Kavian Newsgroups: gmane.comp.tex.context Subject: Re: Curiosity about math.random in LuaTeX Date: Sun, 25 Oct 2009 21:35:09 +0100 Message-ID: References: <3E1D310B-06AE-4B36-B2FF-E60A412A3992@gmail.com> <3cb063a60910231244r441b3e58ud3b013aa4b5f81c4@mail.gmail.com> <4AE40BA9.70502@elvenkind.com> <90AE14A7-CB73-4472-A1CE-30717851FA0D@uni-bonn.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1076) Content-Type: text/plain; charset="windows-1252"; Format="flowed"; DelSp="yes" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1256502931 9682 80.91.229.12 (25 Oct 2009 20:35:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Oct 2009 20:35:31 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Oct 25 21:35:24 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 1N29oA-0002VY-LX for gctc-ntg-context-518@m.gmane.org; Sun, 25 Oct 2009 21:35:22 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 699E1C9AC1; Sun, 25 Oct 2009 21:34:15 +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 uFYWfBB+0ejo; Sun, 25 Oct 2009 21:34:12 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 3D30BC9A8A; Sun, 25 Oct 2009 21:34:12 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 3A11DC9A8A for ; Sun, 25 Oct 2009 21:34:11 +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 yTGO8efE+4Ke for ; Sun, 25 Oct 2009 21:34:08 +0100 (CET) Original-Received: from mail-ew0-f223.google.com (mail-ew0-f223.google.com [209.85.219.223]) by balder.ntg.nl (Postfix) with ESMTP id 1F984C9A70 for ; Sun, 25 Oct 2009 21:34:08 +0100 (CET) Original-Received: by ewy23 with SMTP id 23so10134712ewy.2 for ; Sun, 25 Oct 2009 13:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:content-type:mime-version :subject:from:in-reply-to:date:content-transfer-encoding:message-id :references:to:x-mailer; bh=mawuz9FfvPWDSeqZK8caFF3jUIjrmqVUUBD2s/eJmpc=; b=qpYRV3baf/G7zgf0ur28sCI+VwIuTtQLXqlg4Srb1H5iMCm7BdR+xWL29KAdLFuEUy ySxfDpKlqRMkSm9lrqSfdiVN8R8b6DVwHP3AFp1ohawIeq6Zo6k/zmRgUr97maOAF7z+ Qz6dw9cPCAAoFt7XhWb68Pt6PNfyVge2RO9e0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=df8ledtkBIxnHNwKoUDFREL727WAGJp481etSyfwWdy37K3zdYan6uEb41fhWviaxn AYXxUYGmLHgUtnztwO0Aidh7qe7yEJgvq5KfNXOvunO/F+Lsw6Z080YbtX1bKg3v1Pdb 7cOcr+OXJaIOmU+2MMUeI1fe2nqW291AA4E2Y= Original-Received: by 10.216.93.77 with SMTP id k55mr540420wef.196.1256502911314; Sun, 25 Oct 2009 13:35:11 -0700 (PDT) Original-Received: from ?192.168.0.11? (mna75-3-82-66-231-76.fbx.proxad.net [82.66.231.76]) by mx.google.com with ESMTPS id 10sm5900789eyd.10.2009.10.25.13.35.10 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 25 Oct 2009 13:35:10 -0700 (PDT) In-Reply-To: <90AE14A7-CB73-4472-A1CE-30717851FA0D@uni-bonn.de> X-Mailer: Apple Mail (2.1076) 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:53702 Archived-At: Thomas and Taco: thanks to both of you for your insight. I overlooked = the function math.randomseed() in Lua, and my question was mainly out = of curioisty: in practive one doesn't need to reset the random seed, = as Taco points out. However I couldn't find the right usage of the command =AB = \getrandomnumber =BB=85 Best regards: OK On 25 oct. 2009, at 10:50, Thomas A. Schmitz wrote: > > On Oct 25, 2009, at 9:26 AM, Taco Hoekwater wrote: > >> 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())} > > Ah, that explains why I could never get random numbers in mkiv when = > I tried a year ago. Another suggestion: there's also a = > \getrandomnumber command available in ConTeXt, which seems to work = > well. > > Thomas > _________________________________________________________________________= __________ > 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-co= ntext > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > _________________________________________________________________________= __________ ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________