diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/Message.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/Message.kt index 68eb9365e..00dc905ff 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/Message.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/message/Message.kt @@ -1,4 +1,4 @@ -@file:Suppress("MemberVisibilityCanBePrivate") +@file:Suppress("MemberVisibilityCanBePrivate", "unused") package net.mamoe.mirai.message diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/Utils.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/Utils.kt index 4a45533c9..a0f2ae7ad 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/Utils.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/Utils.kt @@ -15,6 +15,8 @@ import java.util.zip.CRC32 import java.util.zip.GZIPInputStream import java.util.zip.GZIPOutputStream import javax.imageio.ImageIO +import kotlin.random.Random +import kotlin.random.nextInt /** @@ -93,11 +95,7 @@ fun DataInputStream.skip(n: Number) { this.skip(n.toLong()) } -fun getRandomByteArray(length: Int): ByteArray { - val bytes = LinkedList() - repeat(length) { bytes.add((Math.random() * 255).toByte()) } - return bytes.toByteArray() -} +fun getRandomByteArray(length: Int): ByteArray = List(length) { Random.Default.nextInt(0..255).toByte() }.toByteArray() operator fun File.plus(child: String): File = File(this, child)