Returns a random seed in range [1, kMaxRandomSeed] based on the given --gtest_random_seed flag value.
| 534 | // Returns a random seed in range [1, kMaxRandomSeed] based on the |
| 535 | // given --gtest_random_seed flag value. |
| 536 | inline int GetRandomSeedFromFlag(Int32 random_seed_flag) { |
| 537 | const unsigned int raw_seed = (random_seed_flag == 0) ? |
| 538 | static_cast<unsigned int>(GetTimeInMillis()) : |
| 539 | static_cast<unsigned int>(random_seed_flag); |
| 540 | |
| 541 | // Normalizes the actual seed to range [1, kMaxRandomSeed] such that |
| 542 | // it's easy to type. |
| 543 | const int normalized_seed = |
| 544 | static_cast<int>((raw_seed - 1U) % |
| 545 | static_cast<unsigned int>(kMaxRandomSeed)) + 1; |
| 546 | return normalized_seed; |
| 547 | } |
| 548 | |
| 549 | // Returns the first valid random seed after 'seed'. The behavior is |
| 550 | // undefined if 'seed' is invalid. The seed after kMaxRandomSeed is |
no test coverage detected