//方法一 var rand = Boolean(Math.round(Math.random())); conosole.log(rand)
// 方法二: var arr = [true,false] var rand = arr[Math.floor(Math.random()*arr.length)] console.log(rand)