about summary refs log tree commit diff
path: root/absl/random/poisson_distribution_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/random/poisson_distribution_test.cc')
-rw-r--r--absl/random/poisson_distribution_test.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/absl/random/poisson_distribution_test.cc b/absl/random/poisson_distribution_test.cc
index 9d215fbc70f1..8baabd111892 100644
--- a/absl/random/poisson_distribution_test.cc
+++ b/absl/random/poisson_distribution_test.cc
@@ -30,6 +30,7 @@
 #include "absl/container/flat_hash_map.h"
 #include "absl/random/internal/chi_square.h"
 #include "absl/random/internal/distribution_test_util.h"
+#include "absl/random/internal/pcg_engine.h"
 #include "absl/random/internal/sequence_urbg.h"
 #include "absl/random/random.h"
 #include "absl/strings/str_cat.h"
@@ -257,7 +258,10 @@ class PoissonDistributionZTest : public testing::TestWithParam<ZParam>,
   template <typename D>
   bool SingleZTest(const double p, const size_t samples);
 
-  absl::InsecureBitGen rng_;
+  // We use a fixed bit generator for distribution accuracy tests.  This allows
+  // these tests to be deterministic, while still testing the qualify of the
+  // implementation.
+  absl::random_internal::pcg64_2018_engine rng_{0x2B7E151628AED2A6};
 };
 
 template <typename D>
@@ -357,9 +361,13 @@ class PoissonDistributionChiSquaredTest : public testing::TestWithParam<double>,
  private:
   void InitChiSquaredTest(const double buckets);
 
-  absl::InsecureBitGen rng_;
   std::vector<size_t> cutoffs_;
   std::vector<double> expected_;
+
+  // We use a fixed bit generator for distribution accuracy tests.  This allows
+  // these tests to be deterministic, while still testing the qualify of the
+  // implementation.
+  absl::random_internal::pcg64_2018_engine rng_{0x2B7E151628AED2A6};
 };
 
 void PoissonDistributionChiSquaredTest::InitChiSquaredTest(