in reply to Re: Re: Randomly generating histograms
in thread Randomly generating histograms

i'd use map for a one liner to replace for:
map ++$array[rand $elements], 1..$sum;
I wouldn't. This is clearer, faster, and one character shorter:
++$array[rand $elements] for 1..$sum;
Help stamp out void maps and greps!

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re: •Re: Re: Re: Randomly generating histograms
by particle (Vicar) on Mar 27, 2002 at 00:45 UTC
    too true, too true! i usually take that position--i learned it here. i guess i just couldn't resist showing off a bit.

    thanks for keeping me honest, merlyn

    ~Particle ;̃