2011年5月27日 星期五

亂數round


亂數數值範圍:
(Math.round( Math.random() * ( maxValue - minValue )) + minValue);
//產生1 ~ 10之間的亂數
var num:uint = Math.round( Math.random() * ( 10 - 1 )) + 1; 


亂數色彩:
//產生隨機色彩
var color:uint = Math.random() * 0xFFFFFF;

除了R其餘使用亂數:
0xff << 24 | 0xff * Math.random() << 16 | 0xff * Math.random() << 8 | 0xff