Creating a new RNG and replacing rand().

[ Merge of http://go/wvgerrit/84607 ]
[ Merge of http://go/wvgerrit/84608 ]

The primary goal is to replace the use of `rand()` with the random
number generators provided with the C++11 standard.

This simplified generator wraps some of the technical aspects of the
<random> library and provides an interface for uniformly distributed
integers.

As part of the `rand()` purge in the CDM, all uses of the C random int
function in `core()` have been removed.  Places that previously used
`rand()` now use `CdmRandom` facilities.

Test: Linux unittest and Android unittest
Bug: 130680365
Change-Id: Ica383870536ed462dbb80e630c2d66845e38b937
This commit is contained in:
Alex Dale
2019-08-26 14:39:50 -07:00
parent 9da0617606
commit ee56d93454
12 changed files with 406 additions and 78 deletions

View File

@@ -95,13 +95,14 @@ UTIL_SRC_DIR := cdm/util/src
CORE_SRC_DIR := cdm/core/src
LOCAL_SRC_FILES := \
$(CORE_SRC_DIR)/properties.cpp \
$(UTIL_SRC_DIR)/platform.cpp \
$(UTIL_SRC_DIR)/rw_lock.cpp \
$(UTIL_SRC_DIR)/string_conversions.cpp \
$(UTIL_SRC_DIR)/cdm_random.cpp \
$(UTIL_SRC_DIR)/clock.cpp \
$(UTIL_SRC_DIR)/file_store.cpp \
$(UTIL_SRC_DIR)/file_utils.cpp \
$(UTIL_SRC_DIR)/log.cpp \
$(UTIL_SRC_DIR)/platform.cpp \
$(UTIL_SRC_DIR)/rw_lock.cpp \
$(UTIL_SRC_DIR)/string_conversions.cpp \
$(SRC_DIR)/properties_android.cpp \
$(SRC_DIR)/timer.cpp \