Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Generating random 6 digit numbers

by Vennis (Pilgrim)
on Aug 26, 2002 at 12:01 UTC ( [id://192827]=note: print w/replies, xml ) Need Help??


in reply to Generating random 6 digit numbers

Another way, using the perl rand function,

@nums = '0' .. '30'; # change to '000000' .. '999999'; srand; while(@nums){ push(@randnums, splice @nums,int(rand @nums),1); }

If you want to be able to interrupt the process, you could choose to write @nums to a file, reload it and continue.

# Test print: print join(' ',@randnums); print "\n"; print join(' ',sort {$a <=> $b} @randnums);

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2024-03-28 12:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found