This test checks that skipping certain number of samples, is equivalent to generate the same number of samples without skipping.
| 46 | // This test checks that skipping certain number of samples, is equivalent to |
| 47 | // generate the same number of samples without skipping. |
| 48 | TEST(PhiloxRandomTest, SkipMatchTest) { |
| 49 | constexpr int count = 1024; |
| 50 | constexpr int skip_count = 2048; |
| 51 | |
| 52 | uint64 test_seed = GetTestSeed(); |
| 53 | std::vector<uint32> v1(count); |
| 54 | { |
| 55 | PhiloxRandom gen(test_seed); |
| 56 | gen.Skip(skip_count / 4); |
| 57 | FillRandoms<TrivialPhiloxDistribution>(gen, &v1[0], v1.size()); |
| 58 | } |
| 59 | |
| 60 | std::vector<uint32> v2(count + skip_count); |
| 61 | { |
| 62 | PhiloxRandom gen(test_seed); |
| 63 | FillRandoms<TrivialPhiloxDistribution>(gen, &v2[0], v2.size()); |
| 64 | } |
| 65 | |
| 66 | for (int i = 0; i < count; ++i) { |
| 67 | ASSERT_EQ(v1[i], v2[i + skip_count]); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | } // namespace |
| 72 | } // namespace random |
nothing calls this directly
no test coverage detected