nums = [];
r = [];
while (r.length < 6) {
n = Math.floor(Math.random() * 45 + 1);
if (!nums[n]) {
nums[n] = true;
r.push(n);
}
}
r.sort(function(a,b){return a-b});
document.writeln(r);
Output:
'My Computer Programs' 카테고리의 다른 글
(Python) 좌우열기 인쇄 페이지 재설정 (0) | 2012.08.29 |
---|---|
(Go) 로또 번호 생성 (0) | 2012.08.27 |
(Python) 로또 번호 생성 (0) | 2012.08.26 |
(Java) 로또 번호 생성 (0) | 2012.08.26 |
(Windows) Clock (0) | 2012.08.24 |