5
$\begingroup$

So, I've noticed an odd trend in some of my Mathematica results recently- I'm running large Monte Carlo simulations on a system that involves running several jobs independently, each on a different processor. The system is wholly separate from Mathematica's built-in parallelization and multithreading features. The system basically launches a whole new session on each processor, so the simulations aren't connected in anyway.

The issue is, it tends to start them in batches of 3 or 4 simulations at a time. I've noticed that my results tend to be identical across each batch, but different between different batches (ie. the same across all jobs started at the same time, but different across jobs started at different times). Is Mathematica doing something with SeedRandom under the hood that's causing every job started together to be given the same seed? I know that calling SeedRandom without any arguments uses the time of day as the seed, but I don't know how precisely that is measured. If it's at second-scale, that might explain this because batches tend to start at the same (wall-clock) second.

$\endgroup$
6
  • $\begingroup$ I think this shows that two kernels started at the same time will have the same default seed. $\endgroup$
    – Jason B.
    Commented Jul 5, 2017 at 14:51
  • $\begingroup$ That's what I've figured, now I'm just trying to find a way around that that doesn't result in the same problems... $\endgroup$
    – Harper
    Commented Jul 5, 2017 at 15:33
  • 4
    $\begingroup$ This will be improved as of the next release, so that kernels launched at the same time will use different seeds. $\endgroup$
    – ilian
    Commented Jul 5, 2017 at 16:19
  • $\begingroup$ I guess I didn't think this was a dupe on account of the fact that I know what happens if no seed is specified, I was wondering if that's what's going on in this case (ie. the wall-clock second seed default). $\endgroup$
    – Harper
    Commented Jul 5, 2017 at 17:24
  • $\begingroup$ @Marco I don't think you've linked a dupe. There is somewhere on the site an answer that explicitly states that the seed is based (IIRC) on the starting time of the kernel, but it's not in your link... $\endgroup$
    – LLlAMnYP
    Commented Jul 7, 2017 at 9:03

0

Browse other questions tagged or ask your own question.