Randomly choose an array from an 'array of arrays'
Hi,
               
               
               
               
I am parsing floating point numbers from 5 .csv files through Processing and ultimately end up with 5 nos. arrays that contain the parsed data for each file. Each array consists of 199 elements. So far so good.
               
               
Now, what I need to do is to get Processing to grab one of the arrays, at random, so it knows ‘ok, use item3Array’, together with its associated contents list. I was thinking to list the arrays as a 1D array and to call a random index from the 1D array:
               
               
float[] myOneDimensionalArrayofArrays = { item1Array,  item2Array,  item3Array, item4Array, item5Array  };
               
 int randomChoice = myOneDimensionalArrayofArrays  [(int)(random(5))];
               
               
However, the syntax doesn’t work in the manner I tried – I guess I need to find another way of listing the ‘array of arrays’. I looked at a number of proposals posted on the Forum previously. Concatenating the arrays or creating an ArrayList, as I understand it, just creates a long list of data, rather than a list from which I can grab a subgroup from, unless I somehow looped through every 199th element to get the randomly chosen subgroup.
               
Might anyone have an idea how I could approach this matter?
               

 
 
           
 
            