good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: gernerating unique stringby dga (Hermit) |
on Sep 19, 2001 at 20:20 UTC ( [id://113392]=note: print w/replies, xml ) | Need Help?? |
Even if its a 'low volume' form you still may get 2 people hitting it at the same time even if you only get 3 hits on a given day. One easy one if you aren't worried about people making these up to circumvent the reason you are using a random value in the first place would be to use pid and Time::HiRes;
$uniq_value will be something like 153331000916182.10074 This will be unique since the same CGI can't do 2 of these without that last digit stepping with current CPU and network speeds and each process has its own pid so even 2 at the same time will be unique. The number could be predicted in advance since its totally linear and not random at all.
In Section
Seekers of Perl Wisdom
|
|