[SP-pm] TRNGs com Rand

Stanislaw Pusep creaktive at gmail.com
Fri Nov 5 04:49:01 PDT 2010


Legal!
Aproveitando: como vocês fazem para dar um shuffle() num array qqer? Eu
costumo fazer:

my @x = (1..10);
for (my $i = 0; $i <= $#x; $i++) {
    my $j = rand $#x;
    ($x[$i], $x[$j]) = ($x[$j], $x[$i])
}

ABS()



On Fri, Nov 5, 2010 at 01:31, Daniel de Oliveira Mantovani <
mantovani em perl.org.br> wrote:

>
> http://stackoverflow.com/questions/4092348/in-perl-how-can-i-generate-an-array-with-random-values-without-using-a-loop
>
> Além do conceito, eu achei interessante o hack para alterar uma função
> nativa.
>
> []'s
>
> --
> "If you’ve never written anything thoughtful, then you’ve never had
> any difficult, important, or interesting thoughts. That’s the secret:
> people who don’t write, are people who don’t think."
> _______________________________________________
> SaoPaulo-pm mailing list
> SaoPaulo-pm em pm.org
> http://mail.pm.org/mailman/listinfo/saopaulo-pm
>
-------------- Pr�xima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://mail.pm.org/pipermail/saopaulo-pm/attachments/20101105/735a4f00/attachment.html>


More information about the SaoPaulo-pm mailing list