Skip to content

Commit

Permalink
fix: Random must not be instantiated for multiple invocations
Browse files Browse the repository at this point in the history
The default seed for `Random` is clock based, meaning that instantiating
`Random` multiple times will produce identical values if the clock
doesn't change. Use the global shared generator instead for
`#newTravisID`.
  • Loading branch information
theseion committed Jun 15, 2024
1 parent 5d584e4 commit 82fde55
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
instance creation
newTravisID
"Random and image-specific identifier for Travis folds"
| r |
r := Random new.
^ (ByteArray with: (r nextInteger: 255) with: (r nextInteger: 255)) hex
^ (ByteArray with: 255 atRandom with: 255 atRandom) hex

0 comments on commit 82fde55

Please sign in to comment.