JSFiddle - React, Tailwind, and code Playground

by Yaroslav Samardak

JavaScript

let wins = 0
let fails = 0

function asd() {
	const r3 = () => Math.floor(Math.random() * 3) + 1

  const door = r3()
  const a1 = r3()

  if (door === a1) {
  	wins++
  } else {
  	fails++
  }
}

const count = 10000
for (let i = 0; i < count; i++) asd()

console.log(wins, fails, Math.round(wins / count * 100) + '%', 100 - Math.round (wins / count * 100) + '%')