The new C++11 Standard has a whole chapter dedicated to random number generators. But how do I perform the simplest, most common task that used to be coded like this, but without resorting to the standard C library:
srand((unsigned int)time(0));
int i = rand();
Are there reasonable defaults for random-number engines, distributions, and seeds that one could use out of the box?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…