| Ticket UUID: | 1037636 | |||
| Title: | TempFile does not generate random names on fast computers | |||
| Type: | Bug | Version: | None | |
| Submitter: | nobody | Created on: | 2004-09-30 10:19:36 | |
| Subsystem: | fileutil | Assigned To: | andreas_kupries | |
| Priority: | 5 Medium | Severity: | ||
| Status: | Closed | Last Modified: | 2004-12-02 05:26:54 | |
| Resolution: | Fixed | Closed By: | techentin | |
| Closed on: | 2004-12-01 22:26:54 | |||
| Description: |
When you call the TempFile on a fast computer (3GHz w. HT technology) then is generate a name with equal chars like YYYYYYYY The random generation of names use the clock clicks which is machine depended, and if I try to call clock clicks to time right after each other then it returns the same value. Why not use the ::math::random instead? Tcllib 1.6 Best regards Torben A. Hansen [email protected] | |||
| User Comments: |
techentin added on 2004-12-02 05:26:54:
Logged In: YES
user_id=43494
Fixed by changing the random character selection expresison from
append newname [string index $chars \
[expr {([clock clicks] ^ $mypid) % 62}]]
to
append newname [string index $chars \
[expr {int(rand()*62)}]]
Also added a few tests to fileutil.test.
techentin added on 2004-12-02 03:31:18: Logged In: YES user_id=43494 This happens only on Windows, where [clock clicks] doesn't change very often. So [clock clicks] % 64 only generates twelve uniuqe file names. This should use rand() instead. | |||
Home
Blog
Docs
Downloads
Tickets
Timeline
Branches
Tags
Wiki