problem with Random.nextGaussian()

前端 未结 6 2024
别跟我提以往
别跟我提以往 2021-01-12 19:58

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

6条回答
  •  花落未央
    2021-01-12 20:42

    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().

提交回复
热议问题