mardi 14 juillet 2020

matlab: different instances start with the same random seed

Using MATLAB and trying to use a computer cluster to perform 100 repetitions of certain calculation with inherent stochastic nature. Each of those repetitions should include the same code, but with different random seed. It seems that

rng('shuffle')

recommended by documentation may not achieve this if all jobs start running at the same time (on different machines) as the seed used is an integer which seems to be initialized from time (it is monotonously increasing, seems like precision of 100th of a second.

The precision seems reasonable, but "collisions" are still very likely if running 100-1000 instances at the same time, thus corrupting the results statistical interpretation as independent.

Any way to avoid such collisions without manually giving each instance an "instance id" used as seed?




Aucun commentaire:

Enregistrer un commentaire