![](https://secure.gravatar.com/avatar/d0e94fb08d4620cfbd2f8f59a7868637.jpg?s=120&d=mm&r=g)
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