Random.nextGaussian() is supposed to give random no.s with mean 0 and std deviation 1. Many no.s it generated are outside range of [-1,+1]. how can i set so that it gives n
A standard deviation of 1.0 entails that many values will lie outside the [-1,1] range.
If you need to keep within this range, you should use another method, perhaps nextDouble().