웹프로그래밍

Global It Leader!!


jQuery


 
 

중복안하는 랜덤 숫자 발생하기

페이지 정보

작성자 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 7,123회 작성일 10-11-10 09:17

본문

<script>
function setRand(min,max,number) {
    randResult = new Array();
    randList = new Array();
    for(i = min; i <= max; i++) {
    randList.push(i);
    }

    for(i = 0; i < number; i++) {
    getRand();
    }
    alert(randResult);
}

function getRand() {
    randNumber = Math.floor(Math.random() * randList.length);
    randResult.push(randList[randNumber]);
    randList.splice(randNumber,1);
}

//Min, Max, Number
setRand(7,10,3);
</script>

출처 : phpschool

댓글목록

등록된 댓글이 없습니다.

전체 149
게시물 검색
jQuery 목록
번호 제목 글쓴이 조회 날짜
149 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 11369 04-29
148 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9026 03-14
147 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8550 06-15
146 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 8213 08-28
145 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7818 05-07
144 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7622 06-16
열람중 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7124 11-10
142 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7055 04-29
141 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 7021 05-10
140 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6928 09-17
139 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6899 07-26
138 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6598 07-13
137 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6597 06-01
136 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6528 10-03
135 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6480 04-05
134 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6465 06-14
133 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6464 05-03
132 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6457 12-16
131 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6371 05-13
130 no_profile 오원장 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 6266 05-30