2018. 9. 27. 20:39 Back-End/Node

랜덤한 값 생성

shortid


npm install -s shortid


const shortid = require('shortid')
console.log(shortid.generate());


function getRandomInt(min, max) {
//min ~ max 사이의 임의의 정수 반환
return Math.floor(Math.random() * (max - min)) + min;
}

console.log(getRandomInt(0, 100));
출처: http://tom7930.tistory.com/47 [Dr.kim의 나를 위한 블로그]


Posted by Yuni-Q

블로그 이미지
https://github.com/Yuni-Q/TIL에 정리하기 전 잊지 않기 위해 간단하게 메모해 두는 곳입니다.
Yuni-Q

태그목록

공지사항

Yesterday
Today
Total

달력

 « |  » 2025.5
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

최근에 올라온 글

최근에 달린 댓글

글 보관함