static BenchmarkData generate(int param, int howMany, int smallType, int bigType) { IntegerDistribution ud = new UniformIntegerDistribution(new Well19937c(param + 17), Short.MIN_VALUE, Short.MAX_VALUE); ClusteredDataGenerator cd = new ClusteredDataGenerator(); IntegerDistribution p = new UniformIntegerDistribution(new Well19937c(param + 123), SMALLEST_ARRAY, BIGGEST_ARRAY / param); BenchmarkContainer[] smalls = new BenchmarkContainer[howMany]; BenchmarkContainer[] bigs = new BenchmarkContainer[howMany]; for (int i = 0; i < howMany; i++) { int smallSize = p.sample(); int bigSize = smallSize * param; short[] small = smallType == 0 ? generateUniform(ud, smallSize) : generateClustered(cd, smallSize); short[] big = bigType == 0 ? generateUniform(ud, bigSize) : generateClustered(cd, bigSize); smalls[i] = new BenchmarkContainer(small); bigs[i] = new BenchmarkContainer(big); } return new BenchmarkData(smalls, bigs); }
/** {@inheritDoc} */ public int nextInt(final int lower, final int upper) throws NumberIsTooLargeException { return new UniformIntegerDistribution(getRandomGenerator(), lower, upper).sample(); }
} else if (c == UniformIntegerDistribution.class) { UniformIntegerDistribution ud = (UniformIntegerDistribution) d; j.writeNumberField("lower", ud.getSupportLowerBound()); j.writeNumberField("upper", ud.getSupportUpperBound()); } else if (c == ZipfDistribution.class) { ZipfDistribution zd = (ZipfDistribution) d;
UniformIntegerDistribution ua = (UniformIntegerDistribution) a; UniformIntegerDistribution ub = (UniformIntegerDistribution) b; return ua.getSupportUpperBound() == ub.getSupportUpperBound() && ua.getSupportUpperBound() == ub.getSupportUpperBound(); } else if (c == ZipfDistribution.class) { ZipfDistribution za = (ZipfDistribution) a;
} else if (c == UniformIntegerDistribution.class) { UniformIntegerDistribution ud = (UniformIntegerDistribution) d; j.writeNumberField("lower", ud.getSupportLowerBound()); j.writeNumberField("upper", ud.getSupportUpperBound()); } else if (c == ZipfDistribution.class) { ZipfDistribution zd = (ZipfDistribution) d;
UniformIntegerDistribution ua = (UniformIntegerDistribution) a; UniformIntegerDistribution ub = (UniformIntegerDistribution) b; return ua.getSupportUpperBound() == ub.getSupportUpperBound() && ua.getSupportUpperBound() == ub.getSupportUpperBound(); } else if (c == ZipfDistribution.class) { ZipfDistribution za = (ZipfDistribution) a;
static BenchmarkData generate(int param, int howMany, int smallType, int bigType) { IntegerDistribution ud = new UniformIntegerDistribution(new Well19937c(param + 17), Short.MIN_VALUE, Short.MAX_VALUE); ClusteredDataGenerator cd = new ClusteredDataGenerator(); IntegerDistribution p = new UniformIntegerDistribution(new Well19937c(param + 123), SMALLEST_ARRAY, BIGGEST_ARRAY / param); BenchmarkContainer[] smalls = new BenchmarkContainer[howMany]; BenchmarkContainer[] bigs = new BenchmarkContainer[howMany]; for (int i = 0; i < howMany; i++) { int smallSize = p.sample(); int bigSize = smallSize * param; short[] small = smallType == 0 ? generateUniform(ud, smallSize) : generateClustered(cd, smallSize); short[] big = bigType == 0 ? generateUniform(ud, bigSize) : generateClustered(cd, bigSize); smalls[i] = new BenchmarkContainer(small); bigs[i] = new BenchmarkContainer(big); } return new BenchmarkData(smalls, bigs); }
/** {@inheritDoc} */ public int nextSecureInt(final int lower, final int upper) throws NumberIsTooLargeException { return new UniformIntegerDistribution(getSecRan(), lower, upper).sample(); }
/** * Create an IntegerParameterSpace with a uniform distribution between the specified min/max (inclusive) * * @param min Min value, inclusive * @param max Max value, inclusive */ public IntegerParameterSpace(int min, int max) { this(new UniformIntegerDistribution(min, max)); }
} else { target = new UniformIntegerDistribution(rng, start, i).sample(); } else { target = new UniformIntegerDistribution(rng, i, start).sample();
/** * Create an IntegerParameterSpace with a uniform distribution between the specified min/max (inclusive) * * @param min Min value, inclusive * @param max Max value, inclusive */ public IntegerParameterSpace(int min, int max) { this(new UniformIntegerDistribution(min, max)); }
/** {@inheritDoc} */ public int nextInt(final int lower, final int upper) throws NumberIsTooLargeException { return new UniformIntegerDistribution(getRandomGenerator(), lower, upper).sample(); }
public RandomFileExtractToString(String fileName, int minsize, int maxsize, long seed) { this.fileName = fileName; this.minsize = minsize; this.maxsize = maxsize; loadData(); this.rng = new MersenneTwister(seed); this.sizeDistribution = new UniformIntegerDistribution(rng, minsize, maxsize); this.positionDistribution = new UniformIntegerDistribution(rng, 1, fileDataImage.limit() - maxsize); }
/** {@inheritDoc} */ public int nextInt(final int lower, final int upper) throws NumberIsTooLargeException { return new UniformIntegerDistribution(getRandomGenerator(), lower, upper).sample(); }
@Override public Object doWork(Object first, Object second) throws IOException{ if(null == first){ throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - null found for the first value",toExpression(constructingFactory))); } if(null == second){ throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - null found for the second value",toExpression(constructingFactory))); } Number lower = (Number)first; Number upper = (Number)second; return new UniformIntegerDistribution(lower.intValue(), upper.intValue()); } }
/** {@inheritDoc} */ public int nextSecureInt(final int lower, final int upper) throws NumberIsTooLargeException { return new UniformIntegerDistribution(getSecRan(), lower, upper).sample(); }
public RandomLineToString(String filename, long seed) { this.rng = new MersenneTwister(seed); this.filename = filename; this.lines = ResourceFinder.readDataFileLines(filename); itemDistribution= new UniformIntegerDistribution(rng, 0, lines.size()-2); }
} else { target = new UniformIntegerDistribution(rng, start, i).sample(); } else { target = new UniformIntegerDistribution(rng, i, start).sample();
public RandomLineToString(String filename) { this.rng = new MersenneTwister(System.nanoTime()); this.filename = filename; this.lines = ResourceFinder.readDataFileLines(filename); itemDistribution= new UniformIntegerDistribution(rng, 0, lines.size()-2); }
} else { target = new UniformIntegerDistribution(rng, start, i).sample(); } else { target = new UniformIntegerDistribution(rng, i, start).sample();