Fix random number generator usage for unique-id

Note: the performance of many implementations of
random_device degrades sharply once the entropy pool
is exhausted. For practical use, random_device is
generally only used to seed a PRNG such as mt19937.
Means: re-use the mt19937 instance (only init once)

//CC @xzyfer