函數 | 範圍 | 隨機數 |
---|
Math.random() | random 0 to 1 | 第一行 欄位 2 |
Math.floor(Math.random()*10) | random 0 to 9 | |
Math.floor(Math.random()*10+1) | random 1 to 10 | |
Math.floor(Math.random()*100) | random 0 to 99 | |
Math.floor(Math.random()*100+1) | random 1 to 100 | |
var min=20, max=80 Math.floor(Math.random() * (max - min + 1) ) + min; | random 20 to 80 | |
沒有留言:
張貼留言