@Test
	public void testRandom() {
		final int n = 1000;
		
		Bag<Double> myList = new Bag<Double>();		
		ArrayList<Double> bag = new ArrayList<Double>();
		Random rnd = new Random();

		for (int i = 0; i < n; ++i) {
			double x = rnd.nextDouble();
			myList.add(x);
			bag.add(x);
		}

		int size = n;
		for (myList.reset(); myList.hasNext();) {
			myList.next();
			if (rnd.nextDouble() <= 0.33) {
				if (rnd.nextBoolean()) {
					double toAdd = rnd.nextDouble();
					bag.add(toAdd);
					myList.add(toAdd);
				} else {
					double toRemove = bag.remove(rnd.nextInt(size--));
					myList.remove(toRemove);			
				}
			}
		}
		verifyContents(bag, myList);
	}