### Question:
RandomCrossValidator implements CrossValidator { @Override public Iterator<Fold> iterator() { return new FoldIterator(); } RandomCrossValidator(Dataset data);  RandomCrossValidator(Dataset data, int numFolds); @Override Iterator<Fold> iterator(); @Override int getNumFolds();  }### Answer:
@Test public void testCrossValidator() { Dataset data = new RandomDataset(100); RandomCrossValidator crossValidator = new RandomCrossValidator(data, 10); for (TrainTestSplit fold : crossValidator) { int trainSize = CollectionHelper.count(fold.getTrain().iterator()); int testSize = CollectionHelper.count(fold.getTest().iterator()); assertEquals(90, trainSize); assertEquals(10, testSize); Set<Instance> trainSet = CollectionHelper.newHashSet(fold.getTrain()); Set<Instance> testSet = CollectionHelper.newHashSet(fold.getTest()); trainSet.removeAll(testSet); testSet.removeAll(trainSet); assertEquals(90, trainSet.size()); assertEquals(10, testSet.size()); } }