Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Randomize an array

by Zebu (Novice)
on Sep 08, 2000 at 02:09 UTC ( #31505=note: print w/replies, xml ) Need Help??


in reply to Randomize an array

Wow, thanks! 1 line instead of this ugly code:
foreach $prise (@cartes) { $xmel = int (rand(9999)); $cartes[$i++] = $xmel . X . $prise; } @cartes= sort @cartes; $i=0; foreach $prise (@cartes) { $prise=~s/.*X//; $cartes[$i++]=$prise; }

:-)

BTW, it IS meant to shuffle a deck of cards...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://31505]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2019-06-20 22:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (91 votes). Check out past polls.

    Notices?