Random numbers and threads

There isn’t a global random state. There’s a per-task random state used by default, if I understand correctly.

In general, now that Julia 1.7 implemented task migration between threads, it is problematic to use threadid to emulate thread-local state, and one should instead use task-local state.

2 Likes