package lab20;

import java.util.Random;

/**
 * A small polyhedron used to generate random numbers.
 *
 * @author
 * @version
 */
public abstract class Die {

    private static Random random = new Random();

    protected int index;

    /**
     * Sets the random number generator seed for testing expected values.
     *
     * @param seed the initial seed
     */
    public static void test(long seed) {
        random.setSeed(seed);
    }

    /**
     * Simulates rolling the die. This method updates and returns the die's
     * current value.
     *
     * @return current value
     */
    public int roll() {
        index = random.nextInt(sides());
        return value();
    }

    /**
     * Gets the die's number of sides (i.e, how many possible values it has).
     *
     * @return number of sides
     */
    public abstract int sides();

    /**
     * Gets the die's current value (i.e., from the last time it was rolled).
     *
     * @return current value
     */
    public abstract int value();

}
