/** * Removes a circle from {@code zone}, by taking the circle's center in * {@code zone} 's border: {@code border}. * * @param border * {@code result}'s border. */ private void inebriate0(IRNG rng, List<Coord> zone, List<Coord> border, int nb) { assert !border.isEmpty(); assert !zone.isEmpty(); final int width = rng.nextInt(nb) + 1; final int height = rng.nextInt(nb) + 1; final int radius = Math.max(1, Math.round(nb * Math.min(width, height))); final Coord center = rng.getRandomElement(border); zone.remove(center); for (int dx = -radius; dx <= radius; ++dx) { final int high = (int) Math.floor(Math.sqrt(radius * radius - dx * dx)); for (int dy = -high; dy <= high; ++dy) { final Coord c = center.translate(dx, dy); zone.remove(c); if (zone.isEmpty()) return; } } }
sb.append(rng.getRandomElement(openingVowels)); if (syllables == 1) sb.append(rng.getRandomElement(closingConsonants)); else sb.append(rng.getRandomElement(midConsonants)); i++; } else { sb.append(rng.getRandomElement(openingConsonants)); if (i < syllables) { if (rng.nextDouble() < syllableEndFrequency) { close = rng.getRandomElement(closingSyllables); if (close.contains("@") && (syllables & 1) == 0) { redouble = true; ender.append(close); else if (rng.nextDouble() < vowelEndFrequency) { ender.append(rng.getRandomElement(midVowels)); if (rng.nextDouble() < vowelSplitFrequency) { ender.append(rng.getRandomElement(vowelSplitters)) .append(rng.getRandomElement(midVowels)); ender.append(rng.getRandomElement(midVowels)); if (rng.nextDouble() < vowelSplitFrequency) { ender.append(rng.getRandomElement(vowelSplitters)) .append(rng.getRandomElement(midVowels)); ender.append(rng.getRandomElement(closingConsonants)); if (rng.nextDouble() < syllableEndFrequency) {
if (approxSyllables <= 0) { sb.setLength(0); sb.append(rng.getRandomElement(openingVowels)); for (int m = 0; m < modifiers.size(); m++) { modifiers.get(m).modify(rng, sb); int i = 0; if (rng.nextDouble() < vowelStartFrequency) { sb.append(rng.getRandomElement(openingVowels)); if (approxSyllables == 1 && closingConsonants.length > 0) sb.append(rng.getRandomElement(closingConsonants)); else if (midConsonants.length > 0) sb.append(rng.getRandomElement(midConsonants)); i++; } else if (openingConsonants.length > 0) { sb.append(rng.getRandomElement(openingConsonants)); if (i < approxSyllables) { if (closingSyllables.length > 0 && rng.nextDouble() < syllableEndFrequency) { close = rng.getRandomElement(closingSyllables); if (close.contains("@") && (approxSyllables & 1) == 0) { redouble = true; ender.append(close); else if (redouble && rng.nextDouble() < vowelEndFrequency) { ender.append(rng.getRandomElement(midVowels)); if (vowelSplitters.length > 0 && rng.nextDouble() < vowelSplitFrequency) { ender.append(rng.getRandomElement(vowelSplitters)) .append(rng.getRandomElement(midVowels));
for (int i = 1; i < minWords; i++) { if (rng.nextDouble() < midPunctuationFrequency) { ssb.append(rng.getRandomElement(midPunctuation)); ssb.append(rng.getRandomElement(midPunctuation)); ssb.append(rng.getRandomElement(endPunctuation)); return ssb.toString();
for (int i = 1; i < minWords && ssb.length() < maxChars - 7; i++) { if (rng.nextDouble() < midPunctuationFrequency && ssb.length() < maxChars - 3) { ssb.append(rng.getRandomElement(midPunctuation)); ssb.append(rng.getRandomElement(midPunctuation)); next = rng.getRandomElement(endPunctuation); if (ssb.length() + next.length() >= maxChars) ssb.append('.');
protected String[] accentVowels(IRNG rng, String[] me, double influence) { String[] ret = new String[1000]; int otherCount = (int) (1000 * influence); int idx = 0; Matcher matcher; if (me.length > 0) { String[] tmp = new String[me.length]; rng.shuffle(me, tmp); for (idx = 0; idx < otherCount; idx++) { ret[idx] = tmp[idx % tmp.length] .replace('a', accentedVowels[0][rng.nextInt(accentedVowels[0].length)]) .replace('e', accentedVowels[1][rng.nextInt(accentedVowels[1].length)]) .replace('i', accentedVowels[2][rng.nextInt(accentedVowels[2].length)]) .replace('o', accentedVowels[3][rng.nextInt(accentedVowels[3].length)]) .replace('u', accentedVowels[4][rng.nextInt(accentedVowels[4].length)]); matcher = repeats.matcher(ret[idx]); if (matcher.find()) { ret[idx] = matcher.replaceAll(rng.getRandomElement(me)); } } for (; idx < 1000; idx++) { ret[idx] = tmp[idx % tmp.length]; } } else return new String[]{}; return ret; }
ret[idx] = matcher.replaceAll(rng.getRandomElement(me));
int x2 = rng.getRandomElement(availX); int y2 = rng.getRandomElement(availY); dirs.remove(rng.getRandomElement(dirs));
ret[idx] = matcher.replaceAll(rng.getRandomElement(me)); ret[idx] = matcher.replaceAll(rng.getRandomElement(me)); ret[idx] = matcher.replaceAll(rng.getRandomElement(me));