+ 1

What is random() in java?

18th Jun 2018, 12:53 PM
PRASHANT KUMAR BHARDWAJ
PRASHANT KUMAR BHARDWAJ - avatar
3 Answers
+ 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
18th Jun 2018, 1:02 PM
Alexander Sokolov
Alexander Sokolov - avatar
18th Jun 2018, 12:58 PM
Arun Tomar
Arun Tomar - avatar
0
It's method of Math
18th Jun 2018, 12:59 PM
Lstiti