mercredi 18 décembre 2019

std::random_device constructor overhead

From many sources in the net, it is suggested the use of random_device to produce random numbers. All of the code instantiate random_device, applies the proper random_engine or distribution, and makes use of it. I'm wondering, what is the overhead of such pattern? Instantiating the random_device will require the opening of /dev/urandom on linux, so the overhead may be heavier than it seems to appear from that sources. Shouldn't be recommended of a monostate/singleton pattern for this instead?

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire