[SP-pm] TRNGs com Rand

Alexei Znamensky russoz at gmail.com
Fri Nov 5 05:03:44 PDT 2010


2010/11/5 Stanislaw Pusep <creaktive em gmail.com>

> 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])
> }
>

http://www.perlmonks.org/?node_id=1869
<http://www.perlmonks.org/?node_id=1869>

>
> 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
>>
>
>
> _______________________________________________
> SaoPaulo-pm mailing list
> SaoPaulo-pm em pm.org
> http://mail.pm.org/mailman/listinfo/saopaulo-pm
>



-- 
Alexei Znamensky [russoz_gmail_com] [russoz.wordpress.com] [
www.flickr.com/photos/alexeiz]
«Only love / Can bring the rain / That makes you yearn to the sky»
-------------- Pr�xima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://mail.pm.org/pipermail/saopaulo-pm/attachments/20101105/084f582c/attachment.html>


More information about the SaoPaulo-pm mailing list