On Mon, 2021-08-23 at 16:46 +0200, Thierry Horsin via ntg-context wrote: > Hi everybody. > > I wonder how does math.random() work in context. I found that this > subject was discussed more than ten years ago by Otared and Taco and > Thomas. It is clear to me how to obtain new results upon typesetting > the same file by changing the value of math.randomseed (with > os.time()). > > If you don't change the seed, you get the same result upon each > typesetting, and a seed is given in the .tuc file. > > For example I have this: > ["randomseed"]=0x1.0741c18b8a4ep-6 > > How do I use (and is it possible to) this value to have the same > result of math.random() upon typesetting another file (with a > different name) ? > > I could provide a same fixed seed in both files, but for some reasons > I would like to re-use some previous results of math.random() for > which no seed was initially given in another .tex file.
You can immediately forget about that, because in the past Lua has switched the random number generator (RNG) between releases and also uses a different RNG depending on the operating system. In general it is a really bad idea to depend on the exact sequence of random numbers. As an alternative you can just pregenerate a list of random numbers and copy that to other documents. Cheers, Henri > > Thank you > Thierry > _____________________________________________________________________ > ______________ > 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://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > _____________________________________________________________________ > ______________ ___________________________________________________________________________________ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________