ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Thomas A. Schmitz" <thomas.schmitz@uni-bonn.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Curiosity about math.random in LuaTeX
Date: Sun, 25 Oct 2009 10:50:16 +0100	[thread overview]
Message-ID: <90AE14A7-CB73-4472-A1CE-30717851FA0D@uni-bonn.de> (raw)
In-Reply-To: <4AE40BA9.70502@elvenkind.com>


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-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  reply	other threads:[~2009-10-25  9:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-23  8:55 Otared Kavian
2009-10-23 19:44 ` Otared KAVIAN
2009-10-25  8:26   ` Taco Hoekwater
2009-10-25  9:50     ` Thomas A. Schmitz [this message]
2009-10-25 20:35       ` Otared Kavian
     [not found] <mailman.91.1629714784.1197.ntg-context@ntg.nl>
2021-08-23 14:46 ` Thierry Horsin via ntg-context
2021-08-23 15:06   ` Henri Menke via ntg-context
2021-08-23 15:13   ` Hans Hagen via ntg-context
2021-08-23 15:24     ` Hans van der Meer via ntg-context
2021-08-23 15:49       ` Henri Menke via ntg-context
2021-08-23 16:25       ` Hans Hagen via ntg-context
2021-08-23 18:09     ` Thierry Horsin via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=90AE14A7-CB73-4472-A1CE-30717851FA0D@uni-bonn.de \
    --to=thomas.schmitz@uni-bonn.de \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).