In my code I use random numbers in different classes. How to define random seed? Can I define this seed for all the classes in the main code?
double rnd = Math.random();
In my code I use random numbers in different classes. How to define random seed? Can I define this seed for all the classes in the main code?
double rnd = Math.random();
You will probably want to use the special Random class. It gives you more control over the random numbers. To do this you first need to create a new random object.
Then generate a new number by
http://docs.oracle.com/javase/6/docs/api/java/util/Random.html