Skip to content

Latest commit

 

History

History
46 lines (30 loc) · 794 Bytes

README.md

File metadata and controls

46 lines (30 loc) · 794 Bytes

knanoid

BUILD (Ubuntu 20.04)

Description

Allows generating random ID with the provided alphabet and size;

Example

fun org.knanoid.randomNanoId(
    size: Int = defaultSize, // 21
    alphabet: CharArray = defaultAlphabet, // _-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
    random: Random = defaultRandom // Just Random
): String


val result = randomNanoId()
println(result) //o3FfXLK_lFOiB01-jdXgY

Usage

Add to your gradle build file:

repositories {
    ...

    maven {
        url  "https://dl.bintray.com/alekseinovikov/utils"
    }

    ...
}

dependencies {
    ...

    implementation 'org.knanoid:knanoid:1.0'
    
    ...
}