Fixed random number generation that assumed that RAND_MAX == 2147483647.