Fixed segmentation errors in reservoir.cpp. Still need to adjust randomness