package util;
import java.lang.Math;
import java.util.*;
import java.util.Vector;

/**
 * MyVector is a one-method extension of java.util.Vector,
 * one of Java's best-loved utility classes.  The point of
 * MyVector is that it allows random deletion of elements
 * from the Vector.  Hopefully something similar will be
 * supported by the standard Java class libraries at some point.
 */
public class MyVector extends Vector{

    /**
     * This, and all the other constructors are the same as for Vector.
     */
    public MyVector() {super();}
    public MyVector(Collection c) {super();}
    public MyVector(int initialCapacity) {super();}
    public MyVector(int initialCapacity, int capacityIncrement) {super();}

    /** 
     * Removes a random object from the list, and returns the object.
     * The low-quality Math.random() randomizer is used.
     */
    public Object randomRemove() {
        return remove((int)(Math.random()*elementCount));
    }
    
}
