pick random numbers from an array code example
Example 1: js get random number from array
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
const randomMonth = months[Math.floor(Math.random() * months.length)];
console.log("random month =>", randomMonth);
Example 2: get raondom from array java
public static int getRandom(int[] array) {
int rnd = new Random().nextInt(array.length);
return array[rnd];
}