+ 1
What is random() in java?
3 Antworten
+ 4
Hello, PRASHANT KUMAR BHARDWAJ !
The java.util.Random class is a pseudo-random number generator.
The class is represented by two designers
Random () - creates a number generator that uses a unique seed
Random (long seed) - allows you to specify the initial number manually
Since the class creates a pseudo-random number, then by specifying a seed, you define the starting point of the random sequence. And you will receive the same random sequences. To avoid such a coincidence, the second constructor is usually used using the current time as the initiating value.
Methods:
boolean nextBoolean () - returns the next random value of type boolean
void nextBytes (byte [] buf) - fills the array with randomly generated values
double nextDouble () - returns the next random value of type double
float nextFloat () - returns the next random value of type float
+ 2
0
It's method of Math