❮ Math Methods
Example
System.out.println(Math.random());Definition and Usage
The random() method returns a random number between 0 and 1.
This method never returns exactly 1, but it can return 0.
Syntax
public static double random()Technical Details
| Returns: | A double value representing a randomly selected number between 0 and 1, excluding 1 itself. |
|---|---|
| Java version: | Any |