Unique

object Unique

Unique String generator

class Object
trait Matchable
class Any
Unique.type

Value members

Concrete methods

def apply(length: Int, characters: String): String

Generates a unique String using the characters supplied at the length defined.

Generates a unique String using the characters supplied at the length defined.

Value parameters:
characters

the characters for use in the String. Defaults to Unique.defaultCharacters.

length

the length of the resulting String. Defaults to Unique.defaultLength.

Returns:

a unique String

def poolSize(length: Int, characters: String): Long

Returns the number of possible values for a specific length and characters.

Returns the number of possible values for a specific length and characters.

final def threadLocalRandom(max: Int): Int

Uses java.util.concurrent.ThreadLocalRandom to generate random numbers.

Uses java.util.concurrent.ThreadLocalRandom to generate random numbers.

Value parameters:
max

the maximum value to include

Returns:

random number between 0 and max

def uuid: String

Convenience functionality to generate a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier)

Convenience functionality to generate a UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier)

32 characters of unique hexadecimal values with dashes representing 36 total characters

Concrete fields

lazy val AllLettersAndNumbers: String
lazy val Hexadecimal: String
lazy val LettersAndNumbers: String
lazy val LettersLower: String
lazy val LettersUpper: String
lazy val Numbers: String
lazy val Readable: String
var defaultCharacters: String

The default characters to use for generating unique values. Defaults to AllLettersAndNumbers.

The default characters to use for generating unique values. Defaults to AllLettersAndNumbers.

var defaultLength: Int

The default length to use for generating unique values. Defaults to 32.

The default length to use for generating unique values. Defaults to 32.

var random: Int => Int

Random number generator used to generate unique values. Defaults to threadLocalRandom.

Random number generator used to generate unique values. Defaults to threadLocalRandom.