Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Re: random number

by sauoq (Abbot)
on Dec 13, 2002 at 23:40 UTC ( #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
Node Status?
node history
Node Type: note [id://219781]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2020-11-30 15:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?