Preserve RNG state integrity in case unit tests would be run concurrently.

This commit is contained in:
Gilles Sadowski 2021-08-09 10:27:34 +02:00
parent 1444d2d8d1
commit c04dd79f0f
1 changed files with 2 additions and 1 deletions

View File

@ -19,6 +19,7 @@ package org.apache.commons.math4.legacy.optim.nonlinear.scalar.noderiv;
import java.util.Arrays;
import org.apache.commons.rng.UniformRandomProvider;
import org.apache.commons.rng.simple.RandomSource;
import org.apache.commons.rng.simple.ThreadLocalRandomSource;
import org.apache.commons.rng.sampling.distribution.MarsagliaNormalizedGaussianSampler;
import org.apache.commons.rng.sampling.distribution.ContinuousUniformSampler;
import org.apache.commons.math4.legacy.analysis.MultivariateFunction;
@ -113,7 +114,7 @@ final class OptimTestUtils {
/** Creates a RNG instance. */
static UniformRandomProvider rng() {
return RandomSource.MWC_256.create();
return ThreadLocalRandomSource.current(RandomSource.MWC_256);
}
private static class Basis {