Implemented the generateRandomForest() method.