I'm currently facing an issue where I am attempting to choose a random number based on the length of an array.
var myArray = [1,2,3,4,5];
var r = Math.floor(Math.random(myArray.length));
That's what I've come up with so far. If my array has a size of 7, for example, I want 'r' to be a random number from 0 to 7.
However, it keeps returning 'r' as 0, even when I test it in the browser console.
Any assistance on this matter would be highly appreciated!