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 authored and fniephaus committed Jun 17, 2024
1 parent 6189fe8 commit c37fbbf
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 c37fbbf

Please sign in to comment.