Fiveable
Fiveable

random()

Definition

The random() function generates and returns a pseudo-random decimal value between 0.0 (inclusive) and 1.0 (exclusive).

Analogy

Think of random() as your personal lucky wheel spinner at an amusement park. Each time you spin it, it lands on different numbers, giving you a random result. Similarly, the random() function generates different random values each time it is called.

Related terms

Math.random(): This is the actual method call for using the random() function in Java.

Pseudo-random: Pseudo-random refers to a sequence of numbers that appears to be random but is actually generated by an algorithm.

Random number generator: A random number generator is a mathematical function or device that generates a sequence of numbers with no discernible pattern or predictability.

"random()" appears in:

collegeable - rocket pep

Are you a college student?

  • Study guides for the entire semester

  • 200k practice questions

  • Glossary of 50k key terms - memorize important vocab



© 2024 Fiveable Inc. All rights reserved.

AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.


© 2024 Fiveable Inc. All rights reserved.

AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.