title: How do we shuffle an array of radio buttons so that we can randomly click one
body: <p>I've got a set of radio button and part of our testing procedure we've got to manually click the radio buttons' in some type of random way.</p>
  
  <p>It does not have to be any specific radio button that is clicked; however, in each row either the top of bottom radio must be selected.</p>
  
  <p>I tried it with the JS code below but it does not where.</p>
  
  <p>Help Help!</p>
  
  <p><strong>Here is my code:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/Gq6me.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Gq6me.jpg" alt="Radio Buttons and HTML Table"></a></p>
  
  <pre><code>        setTimeout(function() {
  
  
          var radios=  document.body.querySelectorAll('input[type="radio"]'),
              first =false;
  
          for (var i = 0; i &lt; radios.length; i++) {
  
              if (first) {
                  radios[i].click();
                  first = false;
              } else {
                  radios[i+1].click();
                  first =true ;
              }
          }
  
      } , 2000);
  </code></pre>