Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- Selectbox
- yum
- 문자열자르기
- 부모창
- replace
- 천단위
- Oracle
- Eclipse
- TextBox
- smarty
- TPL
- MySQL
- i18n
- SVN
- 한글 깨짐
- 일괄변경
- random
- docker
- 확장자
- JavaScript
- ubuntu
- mariadb
- php
- Postfix
- Python
- install
- RabbitMQ
- centos
- jQuery
Archives
- Today
- Total
wilson's story
[JAVASCRIPT] 랜덤 뽑아오기 본문
반응형
var result = Math.floor(Math.random() * 10) + 1; document.write(result); Math.floor(Math.random() * 100) + 1; //이렇게 하면, 1에서 100까지 나옴 Math.floor(Math.random() * 10); //이렇게 하면, 0에서 9까지 나옴 // Math.floor() 대신 Math.round()를 사용하여 정수화하면 안된다 // Math.round()를 사용하면 1~10까지 나오는 것이 아니라 1~11까지 나오게 됩니다.
반응형