For using Random class to generate random numbers, we have to first create an instance of this class and then invoke methods such as nextInt(), nextDouble(), nextLong() etc using that instance. Like we use "rnum" instance variable.
We can generate random numbers of types integers, float, double, long, booleans using this class.
We can pass arguments to the methods for placing an upper bound on the range of the numbers to be generated. For example, nextInt(200) will generate numbers in the range 0 to 200 both inclusive.
#LearningandTeachingCoding
#JavaProgrammingTutorials
#JavaPrograms