added random number generation