Javatpoint Logo
Javatpoint Logo

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

Test it Now

Output:

Random Double value : 0.9331473599874305
Random Double value : 0.3410043816871041

Example 2

Test it Now

Output:

0.7826712054759732 
0.9263394699584369 
0.4685457032740772 
0.40580525304253123 
0.9551940609374556

Example 3

Test it Now

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
Next TopicJava Random




Help Others, Please Share

facebook twitter pinterest