Improved random no. genration