Well, okay. But all you've done is move the goal posts a little.

Webservers are inherently multitasking, so adding all those digits of date and time is pretty useless as there could be many uploads completing within each given second.

And depending upon the quality of your rand() function, the rand(10000) bit does almost nothing:

perl -E" $t=time; ++$h{ rand(10000) } while time()==$t; my $n=0; $_ > 1 and $n+=$_ for values %h; say $n, ' duplicates in 1 second'; " 13793 duplicates in 1 second perl -E"$t=time; ++$h{ rand(10000) } while time()==$t; my $n=0; $_ > 1 + and $n+=$_ for values %h; say $n, ' duplicates in 1 second';" 400896 duplicates in 1 second >perl -E"$t=time; ++$h{ rand(10000) } while time()==$t; my $n=0; $_ > +1 and $n+=$_ for values %h; say $n, ' duplicates in 1 second';" 504998 duplicates in 1 second

Even with what is probably the best PRNG available, you can still generate duplicates:

c:\test>perl -MMath::Random::MT=rand -E"$t=time; 1 while time==$t; ++$ +h{ rand(10000) } while time()==$t+1; my $n=0; $_ > 1 and $n+=$_ for v +alues %h; say $n, ' duplicates in 1 second';" 4 duplicates in 1 second c:\test>perl -MMath::Random::MT=rand -E"$t=time; 1 while time==$t; ++$ +h{ rand(10000) } while time()==$t+1; my $n=0; $_ > 1 and $n+=$_ for v +alues %h; say $n, ' duplicates in 1 second';" 4 duplicates in 1 second >perl -MMath::Random::MT=rand -E" $t=time; 1 while time==$t; ++$h{ rand(10000) } while time()==$t+1; my $n=0; $_ > 1 and $n+=$_ for values %h; say $n, ' duplicates in 1 second'; " 6 duplicates in 1 second

It takes only a few milliseconds to read and md5 the contents of a medium sized image file.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

In reply to Re^9: Renaming an image file by BrowserUk
in thread Renaming an image file by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.