James E. King, III wrote:
I'm planning to change random_generator to use the header-only random_device based on points made in this discussion:
1. It is more secure. 2. I believe it is the most widely used use case: generating a uuid relatively infrequently (i.e. not in bulk).
Thanks.
Therefore it will look something like this:
// // The default random_generator uses operating-system provided entropy, // is the most secure, and fastest random uuid generator for creating a // small number of uuids with a single generator because it does not need // expensive seeding to be effective like a PseudoRandomNumberGenerator // does. // typedef basic_random_generatordetail::random::random_device random_generator;
I suggest class random_generator { public: typedef uuid result_type; random_generator(); uuid operator()(); }; that is, not using basic_random_generator here at all. There is no need to go through a URNG in this case; random bytes can and should be obtained directly from the OS API.
typedef basic_random_generator<mt19937> random_generator_bulk;
If we guarantee that this will always use mt19937, it might be better to just call it random_generator_mt19937.