n人中m人が当選するくじ
Posted feedbacks - ActionScript
勉強し始めているので、とりあえず投稿
1 2 3 4 5 6 7 8 9 10 | private function execute(n:int, m:int):void {
var res:Array = [];
for (var i:int = 0; i < m;) {
var r:int = Math.floor(Math.random() * n);
if (res.indexOf(r) >= 0) continue;
i++;
res.push(r);
}
Alert.show(res.toString());
}
|

にしお
#3360()
Rating0/0=0.00
[ reply ]