title: The different options for accessing random elements in an array using JavaScript/P5.js
body: <p>I am new to using JavaScript and the P5.js library.  However, I have many years of experience in Processing and some understanding of Java.</p>
  <p>I have worked out 3 ways that I can randomly access an element in an array.  All appear to work however I was wondering what would be best practice. `</p>
  <pre><code>var cars = [&quot;Saab&quot;, &quot;Volvo&quot;, &quot;BMW&quot;];
  
  var rm = Math.floor(Math.random() * cars.length); 
  var ri = int(random(cars.length));
  var words = random(cars);
  </code></pre>
  <p>The first 2 methods are familiar however the 3rd is a new concept, is this somthing that is unique to javaSript.</p>
  <p>Thanks in advance</p>