Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Re: random number

by sauoq (Abbot)
on Dec 13, 2002 at 23:40 UTC ( [id://219781]=note: print w/replies, xml ) Need Help??


in reply to Re: random number
in thread random number

Shuffling the array as suggested by BrowserUk and traveler is the Right Way To Do It™ but if you insist on removing elements from the array, how about

perl -le '@a=1..200; print while $_ = splice @a, rand @a, 1'
?

-sauoq
"My two cents aren't worth a dime.";

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-23 06:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found