Consistent random number generation
Hi, Is it possible to generate consistent random numbers across multiple operating systems. For example, consider the following file: math.randomseed(1000) print(math.random()) print(math.random()) print(math.random()) If I process this using texlua, the output on linux and MacOS is different. Is it possible to get consistent output? Rationate: I use randomization to randomize certain paths in metapost. Not all randomly generated paths look okay, so I play around with the seed until I get a good path. But I have to repeat this process everytime I update my distribution and if I compile on different machines. Thanks, Aditya
In programming usually a (non-crypto-safe) RNG returns the same sequence
everytime it is started with the same seed. Therefore, you often seed with
the current time if you do not want to have reproducable sequences and use
a specific seed when you want reproducable results across certain runs.
There are meany causes to want to have this deterministic “randomnes”:
* As mentioned in this thread: reproducable results across different
systems, OSs and architectures
* Certain kinds of games do transfer/save a base seed instead of the
randomly generated level to save bandwith/diskspace
There are more examples, but in the end, they all rely on reproducing the
sequence over multiple architectures to recreate something exactly the same
way it was before.
Alan BRASLAU
On Tue, 5 Apr 2016 17:43:53 -0400 Aditya Mahajan
wrote: Is it possible to generate consistent random numbers across multiple operating systems.
Then they are not random!
Why not save your chosen "random" paths to files?
Alan
___________________________________________________________________________________ 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
___________________________________________________________________________________
participants (3)
-
Aditya Mahajan
-
Alan BRASLAU
-
Norbert Melzer