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

com.hejinonline.util.UUID.scala Maven / Gradle / Ivy

The newest version!
package com.hejinonline.util

import scala.math.BigInt
import scala.collection.mutable.ArrayBuffer

object UUID {
  def randomUUID(): String = {
    val uuid = java.util.UUID.randomUUID()
    val buffer = new ArrayBuffer[Byte](4)
    buffer ++= BigInt(uuid.getLeastSignificantBits).toByteArray
    buffer ++= BigInt(uuid.getMostSignificantBits).toByteArray
    Base58.encode(buffer.toArray)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy