public class NanoId extends Object
此实现的逻辑基于JavaScript的NanoId实现,见:https://github.com/ai/nanoid
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_SIZE
默认长度
|
Constructor and Description |
---|
NanoId() |
Modifier and Type | Method and Description |
---|---|
static String |
randomNanoId()
生成伪随机的NanoId字符串,长度为默认的
DEFAULT_SIZE ,使用密码安全的伪随机生成器 |
static String |
randomNanoId(int size)
生成伪随机的NanoId字符串
|
static String |
randomNanoId(Random random,
char[] alphabet,
int size)
生成伪随机的NanoId字符串
|
public static final int DEFAULT_SIZE
public static String randomNanoId()
DEFAULT_SIZE
,使用密码安全的伪随机生成器public static String randomNanoId(int size)
size
- ID长度Copyright © 2024. All rights reserved.