Produce a random number.
System.out.println(Math.random()); |
The random() method yields a random number within the range of 0 to 1.
It’s important to note that while this method can produce a value of 0, it never returns exactly 1.
public static double random()
|
Returns: |
A double value representing a randomly chosen number within the range of 0 to 1, where 1 itself is excluded. |
Java Version: |
Any |