Back-End/Node

랜덤한 값 생성

Yuni-Q 2018. 9. 27. 20:39

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의 나를 위한 블로그]