/** * Factory method for constructing UUID generator that uses default (shared) * random number generator for constructing UUIDs according to standard * method number 4. */ public static RandomBasedGenerator randomBasedGenerator() { return randomBasedGenerator(null); }
System.out.print("(using secure random generator, info = '"+r.getProvider().getInfo()+"')"); noArgGenerator = Generators.randomBasedGenerator(r);
/** * Factory method for constructing UUID generator that uses default (shared) * random number generator for constructing UUIDs according to standard * method number 4. */ public static RandomBasedGenerator randomBasedGenerator() { return randomBasedGenerator(null); }
public UUIDRandomIDGenerator() { generator = Generators.randomBasedGenerator(); }
public UUIDRandomIDGenerator() { generator = Generators.randomBasedGenerator(); }
private NoArgGenerator newUuidStrategy(String strategy, String ethernet) { if (STRATEGY_TIME.equalsIgnoreCase(strategy)) { return newTimeBasedGenerator(ethernet); } if (STRATEGY_RANDOM.equalsIgnoreCase(strategy)) { return Generators.randomBasedGenerator(); } throw new IllegalArgumentException("Unknown strategy: " + strategy); }
/** * 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); } }
System.out.print("(using secure random generator, info = '"+r.getProvider().getInfo()+"')"); noArgGenerator = Generators.randomBasedGenerator(r);