Fixed a few parts of the algorithm that expected a double [0.0-1.0)
but instead got a random() which is an int32_t