What is use of Math random() function?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

What is use of Math random() function??

29th Jan 2020, 4:28 PM
Jigar
Jigar - avatar
4 Answers
+ 5
Hi here! For example you need to fill your array random numbers... Or come up with a random digital password, generate a digital captcha...
29th Jan 2020, 4:30 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 2
You use Math.random() to generate a random decimal number between 0 and 1. There are many cases where it could be useful.
29th Jan 2020, 6:25 PM
Seb TheS
Seb TheS - avatar
+ 2
E.g if you're simulating the output of rolling two dice or generating a random outcome in an adventure game.
30th Jan 2020, 3:53 AM
Sonic
Sonic - avatar
+ 2
It is for choosing random numbers or value frome specified range
30th Jan 2020, 5:00 PM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar