JS _ Math.floor(Math.random()*5); how do we split the 5 into decimals? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

JS _ Math.floor(Math.random()*5); how do we split the 5 into decimals?

Var x = Math.floor(Math.random()*5); How would I split that 5 in decimals like this: 0.1, 0.2, 0.3.....0.9, 1, 1.1, 1.2, 1.3, ........ 4.8, 4.9, 5 The 5 is now split into 50 smaller pieces (decimals)? ?

6th Dec 2019, 10:40 PM
Ginfio
Ginfio - avatar
1 Answer
+ 1
Jay Matthews Using that, how would i generate random numbers between 3.0 and 5.0?
7th Dec 2019, 6:22 AM
Ginfio
Ginfio - avatar