What is the use of the Random(long) constructor?

前端 未结 5 2088
我寻月下人不归
我寻月下人不归 2021-01-22 04:04

There are 2 constructors of Random class

  1. public Random()
  2. public Random(long seed)

The description fo

5条回答
  •  遥遥无期
    2021-01-22 04:15

    If you use the constructor with the seed, you will get a repeatable sequence, so it's good for testing. If you use the constructor without the seed, you don't know what sequence of random-like numbers will be produced.

提交回复
热议问题