Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 2, 2020 03:50
Show Gist options
  • Save parzibyte/eaf126d9e799a37784cfe0ef6f53574e to your computer and use it in GitHub Desktop.
Save parzibyte/eaf126d9e799a37784cfe0ef6f53574e to your computer and use it in GitHub Desktop.
const obtenerNumeroAleatorioEnRango = (min, max) => {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
// Probar con 10 números aleatorios entre 1 y 100
for(let i = 0; i < 9; i++){
const numeroAleatorio = obtenerNumeroAleatorioEnRango(1, 100);
console.log("Aleatorio: ", numeroAleatorio);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment