Skip to main content
The new Teacher Workspace is here. Your first 3 assignments are free. Try it →

💻ap computer science a review

Math.random() in AP Computer Science A

Written by the Fiveable Content Team
Verified for the 2027 exam
Verified for the 2027 exam•Written by the Fiveable Content Team

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.

AP course connection

Topic 1.11: 1.11 Using the Math Class

Unit 1

"Math.random()" also found in: