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의 나를 위한 블로그]
'Back-End > Node' 카테고리의 다른 글
swaager (0) | 2018.09.30 |
---|---|
Node (0) | 2018.09.28 |
Node 프로그래밍 시 유의사항 ver.19 제이쿼리 (jQuery) & 표준 라이브러리 (Standard Library) (0) | 2018.09.24 |
Node 프로그래밍 시 유의사항 ver.18 명명규칙 (Naming Conventions) & 접근자 (Accessors) & 이벤트 (Events) (0) | 2018.09.24 |
Node 프로그래밍 시 유의사항 ver.16 쉼표 (Commas) & 세미콜론 (Semicolons) & 형변환과 강제 (Type Casting & Coercion) (0) | 2018.09.24 |