Java Random nextDouble() Method

The nextDouble() method of Random class returns the next pseudorandom, uniformly distributed double value between 0.0 and 1.0 from this random number generator's sequence.

Syntax

Parameters

NA

Return Value

The nextDouble() method returns the next pseudorandom double number between 0.0 and 1.0.

Example 1

Output:

Random Double value : 0.9331473599874305
Random Double value : 0.3410043816871041

Example 2

Output:

0.7826712054759732 
0.9263394699584369 
0.4685457032740772 
0.40580525304253123 
0.9551940609374556

Example 3

Output:

Enter number of students.2
Enter name of 2 students.
1 Reema
2 Saloni
1. Reema'sid  : 0.1132984792177768
2. Saloni'sid  : 0.8604571338175745