[luatex] tex.setrandomseed primitive missing in Lua

Henri Menke henrimenke at gmail.com
Thu Jan 10 01:47:34 CET 2019


On 10/01/19 1:16 PM, Hans Hagen wrote:
> On 1/10/2019 12:15 AM, Henri Menke wrote:
>> On 10/01/19 11:50 AM, Henri Menke wrote:
>>> Dear list,
>>>
>>> To set the random seed of the MP random number generator I have to use
>>> the TeX command \setrandomseed.  I can't do it from the Lua level,
>>> because tex.randomseed is read-only and tex.setrandomseed is nil.
>>> Could you please expose this primitive in Lua?
>>
>> I tried to work around this using
>>
>> \directlua{
>>    token.create("setrandomseed")
>>    token.create(string.byte("1"))
>>    token.expand()
>>    print(tex.randomseed)
>> }
>>
>> but I only get ! Undefined control sequence.
> tex.print("\\setrandomseed ....")

That doesn't work because it is asynchronous.

\directlua{
  tex.print("\noexpand\\setrandomseed1")
  print(tex.randomseed)
}

will print whatever the random seed was initialized with but not 1.

> 
> 
> -----------------------------------------------------------------
>                                           Hans Hagen | PRAGMA ADE
>               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------




More information about the luatex mailing list