leafiy
5/18/2018 - 6:47 PM

随机验证码 #js #math

none

console.log(('000000' + Math.floor(Math.random() * 999999)).slice(-6));


Math.random().toString().slice(-6)


const randomNumberInRange = (min, max) => Math.random() * (max - min) + min;
// randomNumberInRange(2,10) -> 6.0211363285087005