Written by the Fiveable Content Team โข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโขWritten by the Fiveable Content Team โข Last updated September 2025
Definition
Math.random() is a method in Java that generates a random decimal number between 0 (inclusive) and 1 (exclusive). It is commonly used to generate random numbers in programming.
Related terms
Random Number Generator: A program or function that generates numbers with no predictable pattern.
Math.floor(): A method in Java that rounds down a decimal number to the nearest whole number.
Math.ceil(): A method in Java that rounds up a decimal number to the nearest whole number.