Since @Thomas Juranek has corrected your use of Math.random for you, I won't dwell into that. Instead, I will answer your question on retrieving variable using variable names.
I would call this a hack, but variables declared in global are bound to the window object. If you are passing variable name only, you can retrieve it by doing the following:
function getWindowObject(variableName) {
return window[variableName];
}
It definitely makes more sense to just pass the variable, however. A slightly better way to do this, if you insist on wanting to declare loosely hanging variables outside the function scope, would be to wrap it in an object:
var myPersonalScope = {};
myPersonalScope["one"] = [1, 2, 3];
myPersonalScope["two"] = [4, 5, 6];
function getPersonalScopeObject(variableName) {
return myPersonalScope[variableName];
}