in reply to Random distribution

I'd start with an 1-dim array defined as @start_array = ('a' .. 'z'), and then shuffle it using Algorith::Numerical::Shuffle. Then you can break it into the 2-dim array.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

:(){ :|:&};:

Note: All code is untested, unless otherwise stated

Replies are listed 'Best First'.
Re: Re: Random distribution
by ChrisS (Monk) on Oct 24, 2003 at 19:22 UTC
    I suggested using List::Util below, and was just curious (since you recommended the Algorth::... module) do you see significant tradeoffs for either of those modules? I haven't done any benchmarking, but thought you might have some idea.
      The Algorithm::Numeric::Shuffle is a pure Perl solution. I wrote it years ago, 5.005 era I guess. The one in List::Util is in XS and should be much faster than the one in Algorithm::Numeric::Shuffle. I'd go for the one in List::Util, unless you have an old version of Perl and can't easily build XS modules yourself.

      Abigail

      No reason beyond the fact that it was the first thing thing that came up on search.cpan.org for the term 'shuffle'. If List::Util is XS, it's almost certainly faster, so that probably is a better module to use.

      ----
      I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
      -- Schemer

      :(){ :|:&};:

      Note: All code is untested, unless otherwise stated