How do I get the seed from a Random in Java?

后端 未结 7 1456
北荒
北荒 2020-12-03 09:46

I am creating a deep clone for some object. The object contains a Random.

Is it good practice to retrieve the seed from the Random? If so,

7条回答
  •  伪装坚强ぢ
    2020-12-03 10:31

    Interesting paradox... I would not call the cloned Random object random - as a workaround you could try this: when you're cloning your object you can set seed by yourself in both Random instances with the same value.

提交回复
热议问题