automate tuple creation

Ali Çehreli acehreli at yahoo.com
Wed Jan 19 22:35:58 UTC 2022


On 1/19/22 14:33, Ali Çehreli wrote:

 > Random rnd;
 >
 > shared static this() {
 >    rnd = Random(unpredictableSeed);
 > }

But that's a mistake: If rnd is thread-local like that, it should be 
initialized in a 'static this' (not 'shared static this'). Otherwise, 
only the main thread's 'rnd' would be randomized, which is the only 
thread that executes 'shared static this' blocks.

Ali



More information about the Digitalmars-d-learn mailing list