System.out.println(new RandomInt().randomGenerator());
public String randomValue(RandomInt random) { int randomIndex = random.nextInt(0, randomTable.length - 1); return randomTable[randomIndex]; } }
public void rowFinished() { if (randomLong != null) { randomLong.rowFinished(); } else { randomInt.rowFinished(); } }
public void advanceRows(long rowCount) { if (randomLong != null) { randomLong.advanceRows(rowCount); } else { randomInt.advanceRows(rowCount); } } }
protected RandomInt randomInt(long seed, int expectedUsagePerRow){ RandomInt random = new RandomInt(seed, expectedUsagePerRow); randoms.add(random); return random; }
public int getRandomIndex(RandomInt random) { int randomIndex = random.nextInt(0, randomTable.length - 1); return randomTable[randomIndex]; }
public RandomBoundedLong(long seed, boolean use64Bits, long lowValue, long highValue, int expectedRowCount) { if (use64Bits) { this.randomLong = new RandomLong(seed, expectedRowCount); this.randomInt = null; } else { this.randomLong = null; this.randomInt = new RandomInt(seed, expectedRowCount); } this.lowValue = lowValue; this.highValue = highValue; }
public String randomValue(RandomInt randomInt) { checkState(distribution != null, "%s does not have a distribution", name); int randomValue = randomInt.nextInt(0, maxWeight - 1); return distribution[randomValue]; }
public String generate() { StringBuilder output = new StringBuilder(size + MAX_SENTENCE_LENGTH); RandomInt randomInt = new RandomInt(933588178, Integer.MAX_VALUE); while (output.length() < size) { generateSentence(output, randomInt); monitor.updateProgress(Math.min(1.0 * output.length() / size, 1.0)); } output.setLength(size); return output.toString(); }
public long nextValue() { if (randomLong != null) { return randomLong.nextLong(lowValue, highValue); } else { return randomInt.nextInt((int) lowValue, (int) highValue); } }
public TextPool(int size, Distributions distributions, TextGenerationProgressMonitor monitor) { checkNotNull(distributions, "distributions is null"); checkNotNull(monitor, "monitor is null"); ByteArrayBuilder output = new ByteArrayBuilder(size + MAX_SENTENCE_LENGTH); RandomInt randomInt = new RandomInt(933588178, Integer.MAX_VALUE); while (output.getLength() < size) { generateSentence(distributions, output, randomInt); monitor.updateProgress(Math.min(1.0 * output.getLength() / size, 1.0)); } output.erase(output.getLength() - size); textPool = output.getBytes(); textPoolSize = output.getLength(); }