[Solved] I want to return a value of true or false but force it to randomly return false 3% of the time [duplicate]


Check out Math.random(), which gives you a random number [0,1). You want false 3/100 times, so if you multiply your random number by 100, your range will become [0, 100). Then just check if the random number is less than 3, if so, return false.

5

solved I want to return a value of true or false but force it to randomly return false 3% of the time [duplicate]