Java Random.nextDouble()
Syntax
Random.nextDouble() has the following syntax.
public double nextDouble()
Example
In the following code shows how to use Random.nextDouble() method.
//ww w .ja v a 2s .c o m
import java.util.Random;
public class Main {
public static void main( String args[] ){
Random randomno = new Random();
// check next double value
System.out.println("Next double value: " + randomno.nextDouble());
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.util »
Java Tutorial »
java.util »