Alright, I'm understanding this now. I is so happy.
However I need to explain what I'm trying to accomplish, but better terms.
I may get something wrong, so ask if something's not clear.
I have some idea on how I might be able to do it,
but I need to figure out what some things do before I lose the idea.
First, what does array.find do?
Can it select a specific element out of an array?
If so, how do I give it the place value of that element?
The True Problem:
[PART ONE:] var enemies = [enemy1, enemy2, enemy3, enemy4]; // <--The Bank for Enemy Indexes
Each enemy# in the array represents an enemy's index.
There is only FOUR place values in the array. I need to randomly select ONE place value.
I must then use that random place value, to identify and return a specific number from that array.
That specific number can only be a number that is in that array.
Say I have this array:
var enemies = [532, 49, 0, 86];
I can only return one of those specific numbers.
So I randomly choose a place value, then use that place value to find and return a number.
In other words, use Math.random to choose a specific number in that array. (through place value)
Then return that specific number.
[PART TWO:]Once I have that very specific number, say it's 532 from the array above.
Then I must insert it into a new array, here:
Team[0] = new EnemysTeam( 532, E2, E3, E4 ); // <-- Enemy Indexes
This is done by making E1 a global variable. var E1 = 0;
Then once I have my specific number, 532, I update the variable to become: var E1 = 532;
So I understand that by using the Knuth Shuffle, we can swap elements out for a brand new randomized element.
However I'm wanting to not replace the elements, but find and choose them. Randomly.
This is so I can use the element that's chosen, to be inserted in this array:
Team[0] = new EnemysTeam( E1, E2, E3, E4 ); // <-- Enemy Indexes
Through global variables.
[SOLUTION:]Instead we just use Math.random to find a number between 0 and 4. (That's our place value) Or using array.length+1;
Then we use that Place Value to find and choose a number out of the first array.
Once chosen, that number is returned and becomes Variable E1.
Thus, the E1 spot in the second array is now defined.
Then we have to put all this through a For-Loop, until all four spots have been defined. For(var i = 0, i >= 4, i++);
And we have finished our new list of random enemies.
. . . .
[NOTE:] This is a little hard for even me to follow, so please ask if something isn't making sense.
I'm so far out of my league that it doesn't surprise me that most of this might come off as crazy or illegible.