Returns a random seed in range [1, kMaxRandomSeed] based on the given --gtest_random_seed flag value.
| 520 | // Returns a random seed in range [1, kMaxRandomSeed] based on the |
| 521 | // given --gtest_random_seed flag value. |
| 522 | inline int GetRandomSeedFromFlag(Int32 random_seed_flag) { |
| 523 | const unsigned int raw_seed = (random_seed_flag == 0) ? |
| 524 | static_cast<unsigned int>(GetTimeInMillis()) : |
| 525 | static_cast<unsigned int>(random_seed_flag); |
| 526 | |
| 527 | // Normalizes the actual seed to range [1, kMaxRandomSeed] such that |
| 528 | // it's easy to type. |
| 529 | const int normalized_seed = |
| 530 | static_cast<int>((raw_seed - 1U) % |
| 531 | static_cast<unsigned int>(kMaxRandomSeed)) + 1; |
| 532 | return normalized_seed; |
| 533 | } |
| 534 | |
| 535 | // Returns the first valid random seed after 'seed'. The behavior is |
| 536 | // undefined if 'seed' is invalid. The seed after kMaxRandomSeed is |
no test coverage detected