Provides an abstraction for a random number generator (RNG) that produces a stream of pseudo-random numbers.
The current implementation uses C++11 facilities and is therefore not cryptographically secure.
The RNG is salted with the text of the current command line invocation.
In addition, a user may specify a seed (reproducible builds).
In clang, the seed can be set via
-frandom-seed=X
In the back end, the seed can be set via
-rng-seed=X
This is the llvm part of the patch.
clang part: D3391
You could move the ctor to private and make Module a friend to enforce this. I'm not sure you necessarily want that though: the RNG has nothing special from Module, so it could be used without Module (as long as it gets salted). I'm wondering if this second half of the comment is useful? I think an explanation of what good salt is (and why Module's ID is a good choice) would be more useful.