I'm trying to get an array with a randomized set of predefined values.
Suppose I have a regular array of values
var Seed = ['1', true, 3, 'false', 'five']
and I want to pump out variables that take that as seed and return a randomized version of it everytime I
var randomized = new Seed();
console.log(randomized);
// 3, 'five', 1, true, 'false'
or something like that. But everytime...
randomized = new Seed();
console.log(randomized);
// 'five', true, 'false', 1, 3
I even have a nice function to actually randomize the array, but, my array (seed) has to be encapsulated away in a database module along with its randomization code so I could have a clean new ArrayClass()
sort of way to do this.
I'm not sure, but it seems to be that if I could either customize an Array Object's constructor function I could plug in that randomization code there along with the seed array and have it pump out a new randomized array each time.
Again, I'm not sure if it's even possible but I've tried a lot of things like
Seed.prototype.Seed = function(){
// cannot set property Seed of undefined
}
Seed.constructor = function(){
// never gets called
}
I thought something like these might've worked but I guess I've no idea what I'm doing. Please elucidate me.