List of usage examples for org.apache.commons.math3.random SobolSequenceGenerator skipTo
public double[] skipTo(final int index) throws NotPositiveException
From source file:gdsc.smlm.ij.plugins.CreateData.java
/** * Create distribution within an XY border * //from ww w .ja v a2 s . c o m * @param border * @return */ private UniformDistribution createUniformDistribution(double border) { double depth = (settings.fixedDepth) ? settings.depth / settings.pixelPitch : settings.depth / (2 * settings.pixelPitch); // Ensure the focal plane is in the middle of the zDepth double[] max = new double[] { settings.size / 2 - border, settings.size / 2 - border, depth }; double[] min = new double[3]; for (int i = 0; i < 3; i++) min[i] = -max[i]; if (settings.fixedDepth) min[2] = max[2]; // Try using different distributions: final RandomGenerator rand1 = createRandomGenerator(); if (settings.distribution.equals(DISTRIBUTION[UNIFORM_HALTON])) { return new UniformDistribution(min, max, rand1.nextInt()); } if (settings.distribution.equals(DISTRIBUTION[UNIFORM_SOBOL])) { SobolSequenceGenerator rvg = new SobolSequenceGenerator(3); rvg.skipTo(rand1.nextInt()); return new UniformDistribution(min, max, rvg); } // Create a distribution using random generators for each dimension UniformDistribution distribution = new UniformDistribution(min, max, this); return distribution; }