Skip to content

Commit

Permalink
core: TSID now can use a preconfigured random seed using TSID_SEED, g…
Browse files Browse the repository at this point in the history
…ood for test data
  • Loading branch information
angryziber committed Feb 16, 2025
1 parent 950a22a commit ea1bd59
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased
* jdbc: add helpful details to Postgres exception "no hstore extension installed"
* core: TSID now can use a preconfigured random seed using TSID_SEED, good for test data
* json: TSGenerator updates
* outputs records and arrays with shorter syntax, primarily to prevent records of enums from being exhaustive
* outputs provided custom types as separate types and references them
Expand Down
2 changes: 1 addition & 1 deletion core/src/TSID.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import java.util.concurrent.atomic.AtomicInteger
const val RANDOM_BITS = 22
const val RANDOM_MASK = 0x003fffff
val EPOCH = Instant.parse(Config.optional("TSID_EPOCH", "2022-10-21T03:45:00.000Z")).toEpochMilli()
val random = SecureRandom()
val random = Config.optional("TSID_SEED")?.toByteArray()?.let { SecureRandom(it) } ?: SecureRandom()
val counter = AtomicInteger()
@Volatile var lastTime = 0L

Expand Down

0 comments on commit ea1bd59

Please sign in to comment.