Closed NorbertNemec closed 2 years ago
Disclaimer and note about mingw added to the readme.
The added comment is valid but completely misses the point I made:
If random_device is implemented deterministically using a pseudo RNG, feeding it through mt19937 will not improve the situation.
If random_device is implemented using a proper entropy source, feeding it through mt19937 for a single-shot use is a waste of entropy without any gain.
Either way, the code in the example is suboptimal and unnecessarily complex. Using random_device to seed an mt19937 for a single-shot use is never a good idea.
The examples in the README show the generation of a single UUID by using std::random_device to seed a mt19937 and then use that for generating a UUID. While mt19937 is a reasonable intermediate step for generating a sequence of UUIDs, it is a pointless waste of entropy and computing time when generating a single UUID.
For a single-shot UUID generator, the following should be recommended:
Since single-shot UUID generation is a common pattern, one might want to consider deriving a specialized class (e.g. uuid_random_device_generator to do just this.
It might be worth adding a disclaimer that std::random_device may not be properly supported on all systems, as discussed in https://github.com/mariusbancila/stduuid/issues/6