Added <double> for random number generator, minor bug.