JSFiddle - React, Tailwind, and code Playground
HTML
<div id="log"></div>
JavaScript
var ITERATIONS = 1000000;
log.textContent = 'Running...';
setTimeout(function () {
var count = {good: 0, bad: 0};
var i, x;
for (i = 0; i < ITERATIONS; i += 1) {
x = Math.random().toString(16).slice(-6);
result = x.length === 6 && x.indexOf('.') === -1 ? 'good' : 'bad';
count[result] += 1;
}
count.percentBad = count.bad / ITERATIONS * 100 + '%';
log.textContent = JSON.stringify(count);
}, 0);