QWhat does the Math.random() function return in JavaScript?
Question Info
Choose the Best Option
Click any option to instantly check if you're correct.
Explanation
The Math.random() function returns a random float between 0 and 1.
The Math.random() function returns a random float between 0 and 1 because this is the range of values that the function is designed to return.
The function uses a pseudo-random number generator to generate the random float, which means that the numbers it generates are not truly random, but they are good enough for most purposes.
The Math.random() function is often used to generate random numbers for things like games, simulations, and other applications where a truly random number is not required.
Want to remember what you got wrong?
Create a free account in seconds to track your score, revisit mistakes and continue Computer Science and Engineering where you left off.
- Save your progress & streak
- Topic-wise quizzes & scores
- Bookmark tricky questions
- Printable MCQ sets
Nice — 3 questions done!
Don't lose this streak. Sign up free to save your score and pick up exactly where you stopped.
Share This Question
Challenge a friend or share with your study group.