Math.floor(Math.random() + 0.5)
Math.random()的取值范圍是:
0<=Math.random()<1 隨機小數
Math.floor(X) =X的整數位
例如
Math.floor(6.999) === 6
Math.floor(39.001) === 39
Math.floor(8) === 8
Math.floor(Math.random() + 0.5)
Math.random()的取值范圍是:
0<=Math.random()<1 隨機小數
Math.floor(X) =X的整數位
例如
Math.floor(6.999) === 6
Math.floor(39.001) === 39
Math.floor(8) === 8
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。