ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Otared KAVIAN <otared@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Curiosity about math.random in LuaTeX
Date: Fri, 23 Oct 2009 21:44:53 +0200	[thread overview]
Message-ID: <3cb063a60910231244r441b3e58ud3b013aa4b5f81c4@mail.gmail.com> (raw)
In-Reply-To: <3E1D310B-06AE-4B36-B2FF-E60A412A3992@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 652 bytes --]

Hi all,

This is a curiosity question about the function math.random coming from Lua
and used in mkiv:
if I typeset the following test file in mkiv, no matter when nor how many
times, the sequence of numbers which are output are the same…

%%% begin test-random.tex

\starttext

\dorecurse{25}{%
\ctxlua{tex.print(math.random(110,150))}
\qquad
\ctxlua{tex.print(math.random(math.random(110,120),math.random(140,150)))}
\par}

\stoptext

%%% end test-random.tex

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?

Thanks for your attention: OK

[-- Attachment #1.2: Type: text/html, Size: 772 bytes --]

[-- Attachment #2: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
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-23 19:44 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 [this message]
2009-10-25  8:26   ` Taco Hoekwater
2009-10-25  9:50     ` Thomas A. Schmitz
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=3cb063a60910231244r441b3e58ud3b013aa4b5f81c4@mail.gmail.com \
    --to=otared@gmail.com \
    --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).