看板 [ Flash ]
討論串[問題] 亂數取值不包含特定的數
共 3 篇文章
首頁
上一頁
1
下一頁
尾頁

推噓3(3推 0噓 4→)留言7則,0人參與, 最新作者cjcat2266 (CJ Cat)時間13年前 (2012/03/26 04:34), 編輯資訊
0
0
2
內容預覽:
var range:Vector.<int> = Vector.<int>([0, 1, 2, 4]);. var randomNumber:int = range[int(Math.random() * 4)];. --. Blog http://blog.cjcat.net. Gallery h

推噓1(1推 0噓 0→)留言1則,0人參與, 最新作者sysuen (SY SUEN)時間13年前 (2012/03/25 20:31), 編輯資訊
0
0
0
內容預覽:
do {. num=Math.round(Math.random()*4). } while (num==3);. trace(num). --. 發信站: 批踢踢實業坊(ptt.cc). ◆ From: 111.235.208.203.

推噓1(1推 0噓 1→)留言2則,0人參與, 最新作者kencool107 (臉都歪了)時間13年前 (2012/03/25 18:31), 編輯資訊
0
0
0
內容預覽:
如果我想要取亂數0~4. Math.round(Math.random()*4)是這樣寫. 但是如果我想取亂數0~4但不包含3. 那我要怎麼寫呀?. 教教我. --. 發信站: 批踢踢實業坊(ptt.cc). ◆ From: 114.42.243.55.
首頁
上一頁
1
下一頁
尾頁