test_random_number_generator.h 876 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef MEDIA_LEARNING_IMPL_TEST_RANDOM_NUMBER_GENERATOR_H_
  5. #define MEDIA_LEARNING_IMPL_TEST_RANDOM_NUMBER_GENERATOR_H_
  6. #include "media/learning/impl/random_number_generator.h"
  7. namespace media {
  8. // RandomGenerator implementation that provides repeatable (given a seed)
  9. // sequences of numbers that is also platform agnostic.
  10. class TestRandomNumberGenerator : public RandomNumberGenerator {
  11. public:
  12. explicit TestRandomNumberGenerator(uint32_t seed);
  13. ~TestRandomNumberGenerator() override;
  14. // RandomGenerator
  15. uint64_t Generate() override;
  16. static const uint64_t M = 2147483647L; // 2^32-1
  17. int32_t seed_;
  18. };
  19. } // namespace media
  20. #endif // MEDIA_LEARNING_IMPL_TEST_RANDOM_NUMBER_GENERATOR_H_