Maybe just append a random number
Or maybe not.
The OP states that the names must be in sequence. Consider two files created in the epoch second 1090225457. The first file is generated with the rand string 0.837 (rounded). Half a second later, still in the same epoch second, another file is created, and rand returns 0.238 (rounded). The second file will sort before the first...
The same critism can be made of beable's solution elsewhere in this thread.
- another intruder with the mooring of the heat of the Perl
| [reply] |
| [reply] |
Sure, you can make that criticism. But if you think about it, when you read the files in directory order, as long as you don't sort the files, you'll get them in the order they were created. Therefore, appending a random number is a perfectly acceptable method of generating the unique file names. Except for the small possibility of getting the same filename...
| [reply] |
| [reply] [d/l] [select] |