lodash js 双色球生成器

function ball(count,num){

  return _.sampleSize(_.shuffle(_.times(count,a=>a+1)),num)

}

//红球

function redBall(){

  return ball(33,6)

}

//篮球

function blueBall(){

  return ball(16,1)

}

console.log(`${redBall().join(" ")},${blueBall()}`)

Lodash 官网

posted @ 2020-12-07 18:21  tt78  阅读(231)  评论(0)    收藏  举报