I'm not certain why the answers you got in the last node were unsatisfactory, but if you are just looking to move around elements, per array, around randomly you could do something like this:
my @arr1 = qw|10 22 24 21 20 12 32 31 91 20|; my @arr2 = qw|10 22 24 21 20 12 32 31 91 20 11 32 44 51 10 22 82 71 61 + 54|; my @arr3 = qw|14 25 64 71 80|; my @arrays = (\@arr1, \@arr2, \@arr3); foreach my $arrref (@arrays) { for (0..@$arrref - 1) { my $indx = (int(rand()*100)%@$arrref); my $swap = $arrref->[$indx]; $arrref->[$indx] = $arrref->[$_]; $arrref->[$_] = $swap; } } print q|ARR->1 | . join qq| |,@arr1; print qq|\nARR->2 | . join qq| |,@arr2; print qq|\nARR->3 | . join qq| |,@arr3;
Which produces different output every time, but here's one:
ARR->1 31 10 20 20 12 24 32 22 91 21 ARR->2 32 71 10 24 22 10 61 22 44 12 21 20 31 + 91 11 54 51 82 32 20 ARR->3 80 25 64 71 14
I think you need to use perldoc -f on rand, push. Also, look up the use of the modulus operator %.

Celebrate Intellectual Diversity


In reply to Re: Randomize elements among several arrays, while maintaining original array sizes. by InfiniteSilence
in thread Randomize elements among several arrays, while maintaining original array sizes. by BioNrd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.