IntBag.java 936 Bytes
/**
 * An IntBag represents a multiset of integers between min and max.
 * That is, each number between min and max can occur some non-negative
 * number of times in a particular IntBag.
 */
public class IntBag {

    // constructors in java are like __init__ in python
    public IntBag(int min, int max) {

    }

    /**
     * Adds one instance of value to this IntBag.
     * @param value the value to be added
     */
    public void add(int value) {

    }

    /**
     * Returns true when the bag has no instances of any elements
     * and false otherwise.
     * @return true iff the bag is empty
     */
    public boolean isEmpty() {
        return false;
    }

    /**
     * Chooses (but does not remove) a uniformly random element from this
     * IntBag in proportion to how many elements exist for each number.
     * @return the element picked from the bag
     */
    public int pick() {
        return -1;
    }
}