fixed some random number generation stuff