CdmRandomGenerator meets UniformRandomBitGenerator named requirements.

[ Merge of http://go/wvgerrit/89766 ]

Certain C++11 (and newer) standard library functions and classes which
utilize random number generators require that the random number
generators meet the specifications of C++11's UniformRandomBitGenerator
name requirements.  This is especially important as C++17 will remove
support non-compliant alternatives.

This change updates CdmRandomGenerator to meet these requirements.

Bug: 143494945
Test: Linux and Android unit tests
Change-Id: Ib6df44da4969ad7596b16d447c3f8bd9864698f6
This commit is contained in:
Alex Dale
2019-11-20 11:55:47 -08:00
parent 84061e93d6
commit 7ab69e7768
3 changed files with 57 additions and 9 deletions

View File

@@ -46,9 +46,9 @@ void CdmRandomGenerator::Seed(unsigned int s) {
generator_.seed(s);
}
int CdmRandomGenerator::Rand() {
unsigned int CdmRandomGenerator::Rand() {
CdmRandomLock lock(generator_lock_);
std::uniform_int_distribution<int> dist(0, RAND_MAX);
std::uniform_int_distribution<unsigned int> dist(0, RAND_MAX);
return dist(generator_);
}