All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.maryk.core.uuid.generateUUIDBytes.kt Maven / Gradle / Ivy

package maryk.core.uuid

import maryk.core.extensions.bytes.writeBytes
import maryk.lib.uuid.generateUUID

/**
 * Generates UUID ByteArray
 */
fun generateUUIDBytes(): ByteArray {
    val bytes = ByteArray(16)
    var writeIndex = 0
    val writer: (Byte) -> Unit = { bytes[writeIndex++] = it }
    val uuid = generateUUID()

    uuid.first.writeBytes(writer)
    uuid.second.writeBytes(writer)
    return bytes
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy