Skip to content

Fix non deterministic output

Seth Parker requested to merge fix-non-deterministic-output into master

Created by: csparker247

In v1.0.1, repeated runs of vtkIsotropicDiscreteRemeshing would produce the same output. Somewhere along the way during cleanup for C++14, this stopped occurring. This restores this behavior.

In vtkUniformClustering::ComputeInitialRandomSampling, the vertices are shuffled twice. In previous versions, this was performed with std::random_shuffle, which was deprecated in C++14 and removed in C++17. That algorithm used std::rand without first setting a seed, the end result being a predictable shuffle. In v1.1.2, we replaced this with std::shuffle using a seeded random engine. This caused the shuffling to not be repeatable, resulting in different results depending on the runs being performed. This removes the seed for the random engine, thus restoring the old behavior.

It's unclear if this is actually desirable behavior. It's probably fine and preferable for consistent results, though.

Merge request reports