Answers for "get random word from xz file"

0

get random word from xz file

private static List<String> lines = null;
static {
    try {
        lines = Files.readAllLines(new File("bundles.txt").toPath());
    } catch (IOException e) {
        e.printStackTrace();
    }
}
private Random rand = new Random();

public String getRandomItem() {
    return lines.get(rand.nextInt(lines.size()));
}
Posted by: Guest on November-22-2020

Code answers related to "get random word from xz file"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language