mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-30 00:50:37 +08:00
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:
committed by
Sameer Agarwal
parent
79e403b15c
commit
f1dfac8cd6
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user