Skip to content

Instantly share code, notes, and snippets.

@ihorkatkov
Created July 23, 2015 11:52
Show Gist options
  • Save ihorkatkov/0f38524a69ab65f880bd to your computer and use it in GitHub Desktop.
Save ihorkatkov/0f38524a69ab65f880bd to your computer and use it in GitHub Desktop.
[JS] Получение случайного значения из массива
function showRnd(arr) {
var min = 0;
var max = arr.length - 1;
var rand = min + Math.floor(Math.random() * (max + 1 - min));
return arr[rand];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment