๐Ÿ’ปap computer science a review

Math.random()

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.

Pep mascot

"Math.random()" also found in:

Math.random() Definition - AP Computer Science A Key Term | Fiveable