Added random number generation
Fixed random number generation