
goja.core.encry.IdentitieKit Maven / Gradle / Ivy
package goja.core.encry;
import goja.core.StringPool;
import java.security.SecureRandom;
import java.util.UUID;
/**
*
* .
*
*
* @author sagyf yang
* @version 1.0 2014-01-04 13:41
* @since JDK 1.6
*/
public class IdentitieKit {
private static SecureRandom random = new SecureRandom();
public static String uuid() {
return UUID.randomUUID().toString();
}
public static String uuid2() {
return UUID.randomUUID().toString().replaceAll(StringPool.DASH, StringPool.EMPTY);
}
public static long randomLong() {
return Math.abs(random.nextLong());
}
public static String randomBase62(int length) {
byte[] randomBytes = new byte[length];
random.nextBytes(randomBytes);
return EncodeKit.encodeBase62(randomBytes);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy