본문 바로가기

검색하기
프로필사진

  • 분류 전체보기 (69)
    • 개발 관련 유용한 아이템들 (4)
    • 2021 프론트 엔드 로드맵 따라가기 (65)
      • 인터넷 (2)
      • CSS (7)
      • Sass (0)
      • JS (56)
      • Git (0)
      • Package Manager (0)
      • Linters & Fotmatters (0)
    • 이건 어떻게 ? (0)
    • NoSQL (0)
    • Diary (0)
Guestbook
Notice
Recent Posts
Recent Comments
Link
«   2025/05   »
일 월 화 수 목 금 토
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 29 30 31
Tags
  • 정규표현식
  • node
  • JS
  • just-one-small-sip
  • regExp
  • flex-grow
  • Node.js
  • Object.create
  • Sass
  • flex-basis
  • flex-shrink
  • ajax
  • es6
  • css variables
  • css 오버레이
  • improve-iq-by-up-to-10%!
  • flexbox
  • 무료 백엔드 배포
  • img 확대
  • 디자인패턴
  • close together
  • css
  • Engoo
  • css grid
  • Prototype
  • express-handlebars
  • module wrapper function
  • Express
  • shit-christmas
  • select by attribute
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록특정범위 (1)

특정 범위의 랜덤 정수 값 생성 코드

Math.floor(Math.random() * (max - min + 1) + min) 나름대로의 원리 나올 수 있는 최소값이 min 이니까 Math.random()에 무슨 짓을 하든 max - min과 같은 정수를 갖는 최대값이 나와야 함(ex. 2~100 일 경우 98.99999... 까지이다., 여기에 최소값 2를 더하고 버림하면 100이 나오니까). 그러려면 max-min 값에 + 1을 해줘야 하기 때문에 위와 같은 공식이 성립된다.

2021 프론트 엔드 로드맵 따라가기/JS 2021. 6. 4. 14:36
Prev 1 Next

Blog is powered by kakao / Designed by Tistory

티스토리툴바