JSFiddle - React, Tailwind, and code Playground
HTML
<button onclick='myFunction()'>click me</button>
<div id="demo">
<Input type = radio Name = r1 class="myRadios">
<Input type = radio Name = r2 class="myRadios">
<Input type = radio Name = r3 class="myRadios">
<Input type = radio Name = r4 class="myRadios">
<Input type = radio Name = r5 class="myRadios">
</div>
JavaScript
function myFunction() {
var radios = document.getElementsByClassName('myRadios');
for (var i=0; i<radios.length; i++)
{
radios[i].checked = ( (Math.random()*10) > 5);
}
}