Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

RE: RE: RE: Randomizing Unique ID?

by Adam (Vicar)
on Aug 10, 2000 at 00:11 UTC ( [id://27183]=note: print w/replies, xml ) Need Help??


in reply to RE: RE: Randomizing Unique ID?
in thread Randomizing Unique ID?

You can have the best of both worlds. Use a combination of randomness and uniqueness to make the output unique. Something like, (and I am building on the code in RE: RE: RE: Randomizing Unique ID? ):
my $ID = $ToBase62->( $$ ) . $ToBase62->( rand( $$ ) ) . $ToBase62->( +time );
Not forgeting to call srand() at some point.
And of course, you can use whatever rand() you want.

Update: Don't bother seeding. Tye explains the internal seed here. Also, see the Base Conversion Utility.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-25 20:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found