14 #ifndef OR_TOOLS_BASE_RANDOM_H_
15 #define OR_TOOLS_BASE_RANDOM_H_
20 #include "absl/random/random.h"
28 explicit ACMRandom(int32_t seed) : generator_(seed) {}
41 void Reset(int32_t seed) { generator_.seed(seed); }
52 std::mt19937 generator_;
60 :
ACMRandom(GenerateInt32SeedFromString(str_seed)) {}
65 int32_t GenerateInt32SeedFromString(
const std::string& str) {
66 uint32_t seed = 1234567;
67 for (
size_t i = 0; i < str.size(); ++i) {
69 seed +=
static_cast<uint32_t
>(str[i]);
static int32_t HostnamePidTimeSeed()
static int32_t DeterministicSeed()
static constexpr result_type max()
static constexpr result_type min()
uint32_t Uniform(uint32_t n)
MTRandom(const std::string &str_seed)
static const uint32_t kuint32max
Collection of objects used to extend the Constraint Solver library.