La copia del código es la siguiente:
/**
* Valor mínimo de bajo valor
* Valor máximo superior
*/
función selectFrom (LowerValue, UpPerValue) {
// número total de rangos de valor
opciones var = uppervalue - LowerValue + 1;
return Math.floor (Math.random () * opciones + LowerValue);
}
var num = selectFrom (2, 10);
alerta (num); // un valor entre 2 y 10 (incluyendo 2 y 10)
var colores = ["rojo", "verde", "azul", "amarillo", "negro", "marrón"];
var color = colores [selectFrom (0, colores.length-1)];
alerta (color); // puede ser cualquier valor contenido en la matriz