Some minor changes for the random generator