Changed random numbers generation.