Changed random number generation;