import java.util.Random;

public class RandomElementExample<E> {
 
    private Random random;
    private E[] values;
    
    public GenericClassExample(E[] values) {
        random = new Random();
        this.values = values;    
    }
    
    public E getRandomValue() {
        return values[random.nextInt(values.length)];
    }
}