Random class acting odd?

后端 未结 6 723
粉色の甜心
粉色の甜心 2020-12-03 21:33

In this code:

Random random = new Random(441287210);
for(int i=0;i<10;i++)
    System.out.print(random.nextInt(10)+\" \");
}

The output

6条回答
  •  醉梦人生
    2020-12-03 21:55

    Let it print a couple more, the first 100 are

    1 1 1 1 1 1 1 1 1 1 3 4 7 2 2 6 0 3 0 2 8 4 1 6 0 0 0 2 8 2 9 8 9 2 5 2 1 1 4 5 3 4 1 4 1
    8 7 6 6 0 6 5 0 4 5 5 6 0 8 3 8 9 7 4 0 9 9 7 7 9 3 9 6 4 5 0 6 3 7 4 9 8 7 6 2 8 9 8 4 4
    8 4 9 0 1 6 9 6 1 5
    

    which looks okay.

    Every good (pseudo) random sequence contains streaks of repeated numbers, this one begins with one.

提交回复
热议问题