<SPAN style="FONT-SIZE: 18px">1.Math.random(); The result is a random number between 0 and 1 (including 0, excluding 1) </SPAN>
Math.random(); The result is a random number between 0 and 1 (including 0, excluding 1) [html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px">
2.Math.floor(num); The parameter num is a numerical value, and the function result is the integer part of num (returns the largest integer less than or equal to n). </SPAN>
Math.floor(num); The parameter num is a numerical value, and the function result is the integer part of num (returns the largest integer less than or equal to n). [html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px">
3.Math.round(num); The parameter num is a numerical value, and the function result is the integer after num is rounded. </SPAN>
Math.round(num); The parameter num is a numerical value, and the function result is the integer after num is rounded. [html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px">
4.Math.ceil(n); Returns the smallest integer greater than or equal to n. </SPAN>
Math.ceil(n); Returns the smallest integer greater than or equal to n. [html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px">
5.Math.ceil(Math.random()*10); mainly obtains random integers from 1 to 10, and the probability of obtaining 0 is extremely small. </SPAN>
Math.ceil(Math.random()*10); mainly obtains random integers from 1 to 10, and the probability of obtaining 0 is extremely small. [html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px">
6.Math.round(Math.random()); can obtain random integers from 0 to 1 evenly. </SPAN>
Math.round(Math.random()); can obtain random integers from 0 to 1 evenly. [html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px">
7.Math.round(Math.random()*10);, you can obtain random integers from 0 to 10 in a basically balanced manner, and the probability of obtaining the minimum value 0 and the maximum value 10 is less than half. </SPAN>
When Math.round(Math.random()*10);, random integers from 0 to 10 can be obtained in a basically balanced manner, and the probability of obtaining the minimum value 0 and the maximum value 10 is less than half. [html] view plaincopyprint?
<SPAN style="FONT-SIZE: 18px">
8.Math.floor(Math.random()*10); can obtain random integers from 0 to 9 evenly. </SPAN>