package org.project.util;

import java.util.concurrent.ThreadLocalRandom;

/**
 * Tiny wrapper around the random number generator so the rest of the code reads
 * nicely (e.g. {@code Dice.chance(20)} instead of raw Random calls everywhere).
 */
public final class Dice {

    private Dice() {
    }

    /**
     * @param percent a value from 0 to 100
     * @return true with the given percentage probability
     */
    public static boolean chance(int percent) {
        return ThreadLocalRandom.current().nextInt(100) < percent;
    }

    /** @return a random integer in the inclusive range [min, max]. */
    public static int between(int min, int max) {
        return ThreadLocalRandom.current().nextInt(min, max + 1);
    }
}
