Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 18 lines (13 sloc) 339 Bytes
'use strict';
function flatten(arrayOfArrays) {
return [].concat.apply([], arrayOfArrays);
}
function randomFromArray(arr) {
return arr[Math.floor(Math.random() * arr.length)];
}
function randomKeyFromObject(obj) {
return randomFromArray(Object.keys(obj));
}
function clamp(x, min, max) {
return Math.min(Math.max(x, min), max);
}