+ 5
Random on javascript
did anybody know how to make a random function on sololearn
2 Answers
+ 10
Math.random();
useđ
var a = Math.random();
So the value of a would be anything between 0 to 1
As per your use you could perform multiply addition division etc...
A random dice would be
document.write(Math.round(Math.random()*5+1);
thisâïžwill result in a random dice..đ
+ 4