An algorithm for generating a user's uid

find an algorithm for generating a user"s uid

Jul.29,2021

use the UUID class that comes with java

package java.util.UUID

String recodId = UUID.randomUUID().toString().replaceAll("-", "");
There are many solutions for

. Using UUID can basically satisfy most scenarios, but because UUID is not orderly, it does not perform very well in scenarios that require ordering. You can learn about the Snowflake algorithm


you can use this package. If you want to go deeper, you can see how he did it.
node-uuid


cat / proc/sys/kernel/random/uuid

Menu