Why 2^31 is not divisible by n?

前端 未结 3 1317
梦如初夏
梦如初夏 2021-01-18 15:39

http://docs.oracle.com/javase/6/docs/api/java/util/Random.html#nextInt%28int%29 says:

The algorithm is slightly tricky. It rejects values that would r

3条回答
  •  太阳男子
    2021-01-18 16:02

    Regarding the first question:

    As I understand the sentence, it's said that an uneven distribution is caused when 2^31 is not divisible by n.

    I'm sorry but I don't know for the second question.

提交回复
热议问题