|Syntactic Confectionery Delight|
Randomize elements among several arrays, while maintaining original array sizes.by BioNrd (Monk)
|on Aug 01, 2008 at 15:40 UTC||Need Help??|
BioNrd has asked for the wisdom of the Perl Monks concerning the following question:
I know how to randomize an array 31461. I know how to splice elements among arrays.
What I don't know is how to combine the two, such that I shuffle items in array A among all possible other arrays. e.g. I randomly assign where items in array A go (from A into A, B, C ... N), while maintaining the size of A, B, C, ... N.
Here is how I have been thinking about it thus far:
The problem with this is that it moves to many or not enough items into A B and C. So, is there a way to keep the sizes of the arrays same, but shuffle the items as I have tried to do above?
Thanks for any help the esteemed monks can give,
---- Even a blind squirrel finds a nut sometimes.