diff --git a/detekt-baseline.xml b/detekt-baseline.xml
index 824050f..bfe607d 100644
--- a/detekt-baseline.xml
+++ b/detekt-baseline.xml
@@ -69,7 +69,6 @@
MagicNumber:UUID.kt$UUID$0x0fffL
MagicNumber:UUID.kt$UUID$0x1fff
MagicNumber:UUID.kt$UUID$0xf000L
- MagicNumber:UUID.kt$UUID$0xffff00000000L
MagicNumber:UUID.kt$UUID$0xffff0000L
MagicNumber:UUID.kt$UUID$0xffffffffffffL
MagicNumber:UUID.kt$UUID$12
@@ -90,9 +89,9 @@
MagicNumber:UUID7.kt$0x3fffffffffffffffL
MagicNumber:UUID7.kt$0x7000L
MagicNumber:UUID7.kt$0x80L
+ MagicNumber:UUID7.kt$12
MagicNumber:UUID7.kt$16
- MagicNumber:UUID7.kt$20
TooManyFunctions:SHA1.kt$SHA1
- VariableNaming:UUID7.kt$val rand_a = (random.nextInt() shr 20).toLong()
+ VariableNaming:UUID7.kt$val rand_a = random.nextBits(12).toLong()
diff --git a/kotlinx-uuid-core/src/commonMain/kotlin/kotlinx/uuid/UUID7.kt b/kotlinx-uuid-core/src/commonMain/kotlin/kotlinx/uuid/UUID7.kt
index eecde96..be36623 100644
--- a/kotlinx-uuid-core/src/commonMain/kotlin/kotlinx/uuid/UUID7.kt
+++ b/kotlinx-uuid-core/src/commonMain/kotlin/kotlinx/uuid/UUID7.kt
@@ -14,10 +14,10 @@ private const val UNIX_48_TIMESTAMP = 0x1FFF_FFFF_FFFF_FL
@UUIDExperimentalAPI
public fun UUIDv7(timeStamp: Long, random: Random = SecureRandom): UUID {
require(timeStamp <= UNIX_48_TIMESTAMP) {
- "timeStamp $timeStamp must be 48 bits, was $timeStamp."
+ "timeStamp $timeStamp must be <= 48 bits, was $timeStamp."
}
val leftTimeStamp = timeStamp shl 16
- val rand_a = (random.nextInt() shr 20).toLong()
+ val rand_a = random.nextBits(12).toLong()
val timeStampAndVersionRaw = (leftTimeStamp or rand_a) and -0xf001L or 0x7000L
// set variant to 4 or 5