SOURCE

function getRandom(min, max) {
  const floatRandom = Math.random()

  const difference = max - min

  // 介于 0 和差值之间的随机数
  const random = Math.round(difference * floatRandom)

  const randomWithinRange = random + min

  return randomWithinRange
}

let startList = []
let endList = []

let genType = '员工'
// let genType = '保洁'

for(let i=0; i<31;i++){
    if(genType == '保洁'){
        /* 保洁 */
        let startTime = `06:0${getRandom(1,9)}`
        // let endTime = `07:0${getRandom(1,9)}`
        let endTime = `07:0${getRandom(1,9)}`
        startList.push(startTime)
        endList.push(endTime)
    }else if(genType == '员工'){
        /* 员工 */
        let startTime = `08:2${getRandom(1,9)}`
        let endTime = `18:0${getRandom(1,9)}`
        startList.push(startTime)
        endList.push(endTime)
        
    }
    
   
}
// console.log(list.join('\t'))
console.log(startList.join('\t'))
console.log(endList.join('\t'))
console 命令行工具 X clear

                    
>
console