Reduce the number of individual PRNG instances

Use same instance of a PRNG throughout by passing it to methods and
functions as an argument to generate random numbers without breaking the
sequence.

Change-Id: Ib024bbc1ea2d14e4b9afb71857856a5fb77b1667
This commit is contained in:
Sergiu Deitsch
2022-08-08 21:06:22 +02:00
committed by Sameer Agarwal
parent 79e403b15c
commit f1dfac8cd6
23 changed files with 186 additions and 140 deletions
+1 -1
View File
@@ -265,7 +265,7 @@ TEST(_, ReorderResidualBlocksbyPartition) {
problem.GetResidualBlocks(&residual_block_ids);
std::vector<ResidualBlock*> residual_blocks =
problem.program().residual_blocks();
auto rng = std::default_random_engine{};
auto rng = std::mt19937{};
for (int i = 1; i < 6; ++i) {
std::shuffle(
std::begin(residual_block_ids), std::end(residual_block_ids), rng);