JSFiddle - React, Tailwind, and code Playground
JavaScript
(function(){
const ITERATIONS = 100000
let changeResult = 0,
noChangeResult = 0
for (let i = 0; i < ITERATIONS; i++) {
let secret = Math.round(Math.random() * 3 - .5),
user = Math.round(Math.random() * 3 - .5)
if (user === secret) {
noChangeResult++
} else {
changeResult++
}
}
console.log('result for\nchange: %s\nnochnge:%s\n', changeResult, noChangeResult)
})()