let vals = SpreadsheetApp.getActive().getRangeByName(name).getValues() //get all values in the named range
let n = Math.floor(Math.random() * vals.length) -1 //generate a random number between 0 and the length of the array
let val = vals[n][0] //get the value at the random index