Js Math random round ceil floor usage summary

  • 2020-03-30 01:03:34
  • OfStack

< SPAN style = "FONT - SIZE: 18 px" > 1. Math. The random (); The result is a random number between 0 and 1 (including 0, not including 1) < / SPAN>  
Math. The random (); The result is a random number between 0 and 1 (including 0, not including 1) [HTML] view plaincopyprint?
< SPAN style = "FONT - SIZE: 18 px" >  

2. Math. Floor (num); The argument num is a numeric value and the result of the function is the integer part of num (returning the largest integer less than or equal to n). < / SPAN>  


Math. Floor (num); The argument num is a numeric value and the result of the function is the integer part of num (returning the largest integer less than or equal to n). [HTML] view plaincopyprint?
< SPAN style = "FONT - SIZE: 18 px" >  

3. Math. Round (num); The parameter num is a numeric value and the result of the function is the rounded integer of num. < / SPAN>  


Math. Round (num); The parameter num is a numeric value and the result of the function is the rounded integer of num. [HTML] view plaincopyprint?
< SPAN style = "FONT - SIZE: 18 px" >  

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: 18 px" >  

5. Math. Ceil (Math. The random (10); , it mainly gets random integers from 1 to 10, and the probability of taking 0 is very small. < / SPAN>  


Math. Ceil (Math. The random (10); , it mainly gets random integers from 1 to 10, and the probability of taking 0 is very small. [HTML] view plaincopyprint?
< SPAN style = "FONT - SIZE: 18 px" >  

6. Math. Round (Math. The random ()); The random integer from 0 to 1 can be obtained equitably. < / SPAN>  


Math. Round (Math. The random ()); The random integer from 0 to 1 can be obtained equitably. [HTML] view plaincopyprint?
< SPAN style = "FONT - SIZE: 18 px" >  

7. Math. Round (Math. The random (10); When, random integers from 0 to 10 can be obtained in basic equilibrium, in which the probability of obtaining the minimum value 0 and the maximum value 10 is less than half. < / SPAN>  


Math. Round (Math. The random (10); When, random integers from 0 to 10 can be obtained in basic equilibrium, in which the probability of obtaining the minimum value 0 and the maximum value 10 is less than half. [HTML] view plaincopyprint?
< SPAN style = "FONT - SIZE: 18 px" >  

8. Math. Floor (Math. The random (10); , the random integer from 0 to 9 can be obtained equitably. < / SPAN>  


Related articles: