JSFiddle - React, Tailwind, and code Playground

HTML

<div id="1">1</div>
<div id="2">2</div>
<div id="3">3</div>
<div id="4">4</div>
<div id="5">5</div>

CSS

div { border: 1px solid; }

JavaScript

// Simulated Faulty RNG
function r() {
    var rand = Math.floor(Math.random() * 5 + 1);
    if(rand < 5) {
        rand = 2;
    }
    return rand;
}

// Keep a tally of each output number
tally = [0, 0, 0, 0, 0];
total = 0;
alert = function(n) {
    tally[n - 1]++;
    total++;
    if(total > 1000) {
        for(var x = 0; x < 5; x++) {
            document.getElementById(x + 1).style.width = tally[x] + 'px';
        }
        throw "stop!!!";
    }
}

// The code golf entry itself
for(;;v<5&&alert(v+1))for(v=i=0;i<3;a-b&&(v*=2,v+=a<b,i++))b=r(a=r())