jeudi 22 juin 2023

How to get "default" random object (or seed) in Java?

I know that I can create Random object and set seed for the object like this:

Random random = new Random();
random.setSeed(seed);

But what if I can't create Random object? What if I have to use Math.random()?

I know that Math.random() creates Random object behind the scene.

So the question is there any way to get the Random object created by Math.random and set seed for the object or at least get seed that the object is using?




Aucun commentaire:

Enregistrer un commentaire