public static java.util.UUID random() { return uuidGenerator.generate(); } }
public static UUID generateRandomUUID() { return UUID_GENERATOR.generate(); }
public static UUID generateRandomUUID() { return UUID_GENERATOR.generate(); }
/** * Return the next unique id for the type with the given name using the generator's id generation strategy. * * @return */ @Override public long getId() { return generator.generate().getMostSignificantBits(); }
/** * Return the next unique id for the type with the given name using the generator's id generation strategy. * * @return */ @Override public long getId() { return generator.generate().getMostSignificantBits(); }
/** * Generate short version random UUID * * @return UUID */ public static String shortUuid() { RandomBasedGenerator generator = Generators.randomBasedGenerator(); UUID uuid = generator.generate(); // https://gist.github.com/LeeSanghoon/5811136 long l = ByteBuffer.wrap(uuid.toString().getBytes()).getLong(); return Long.toString(l, Character.MAX_RADIX); } }
/** * Create a random UUID string which does not include dashes. * * @return */ public String randomUUID() { final UUID uuid = UUID_GENERATOR.generate(); String randomUuid = (digits(uuid.getMostSignificantBits() >> 32, 8) + digits(uuid.getMostSignificantBits() >> 16, 4) + digits(uuid .getMostSignificantBits(), 4) + digits(uuid.getLeastSignificantBits() >> 48, 4) + digits(uuid.getLeastSignificantBits(), 12)); return randomUuid; }
/** * Create a random UUID string which does not include dashes. * * @return */ public static String randomUUID() { final UUID uuid = UUID_GENERATOR.generate(); return (digits(uuid.getMostSignificantBits() >> 32, 8) + digits(uuid.getMostSignificantBits() >> 16, 4) + digits(uuid.getMostSignificantBits(), 4) + digits(uuid.getLeastSignificantBits() >> 48, 4) + digits(uuid.getLeastSignificantBits(), 12)); }