Tabnine Logo
RandomBasedGenerator
Code IndexAdd Tabnine to your IDE (free)

How to use
RandomBasedGenerator
in
com.fasterxml.uuid.impl

Best Java code snippets using com.fasterxml.uuid.impl.RandomBasedGenerator (Showing top 14 results out of 315)

origin: camunda/camunda-bpm-platform

/**
 * Factory method for constructing UUID generator that uses specified
 * random number generator for constructing UUIDs according to standard
 * method number 4.
 */
public static RandomBasedGenerator randomBasedGenerator(Random rnd) {
  return new RandomBasedGenerator(rnd);
}
origin: camunda/camunda-bpm-platform

private final static long _toLong(byte[] buffer, int offset)
{
  long l1 = _toInt(buffer, offset);
  long l2 = _toInt(buffer, offset+4);
  long l = (l1 << 32) + ((l2 << 32) >>> 32);
  return l;
}
origin: camunda/camunda-bpm-platform

@Override
public UUID generate()
{
  /* 14-Oct-2010, tatu: Surprisingly, variant for reading byte array is
   *   tad faster for SecureRandom... so let's use that then
   */
  long r1, r2;
  if (_secureRandom) {
    final byte[] buffer = new byte[16];
    _random.nextBytes(buffer);
    r1 = _toLong(buffer, 0);
    r2 = _toLong(buffer, 1);
  } else {
    r1 = _random.nextLong();
    r2 = _random.nextLong();
  }
  return UUIDUtil.constructUUID(UUIDType.RANDOM_BASED, r1, r2);
}
origin: io.gravitee.common/gravitee-common

  public static java.util.UUID random() {
    return uuidGenerator.generate();
  }
}
origin: org.apache.syncope.core/syncope-core-spring

public static UUID generateRandomUUID() {
  return UUID_GENERATOR.generate();
}
origin: apache/syncope

public static UUID generateRandomUUID() {
  return UUID_GENERATOR.generate();
}
origin: cowtowncoder/java-uuid-generator

/**
 * Factory method for constructing UUID generator that uses specified
 * random number generator for constructing UUIDs according to standard
 * method number 4.
 */
public static RandomBasedGenerator randomBasedGenerator(Random rnd) {
  return new RandomBasedGenerator(rnd);
}
origin: cowtowncoder/java-uuid-generator

private final static long _toLong(byte[] buffer, int offset)
{
  long l1 = _toInt(buffer, offset);
  long l2 = _toInt(buffer, offset+4);
  long l = (l1 << 32) + ((l2 << 32) >>> 32);
  return l;
}
origin: cowtowncoder/java-uuid-generator

@Override
public UUID generate()
{
  /* 14-Oct-2010, tatu: Surprisingly, variant for reading byte array is
   *   tad faster for SecureRandom... so let's use that then
   */
  long r1, r2;
  if (_secureRandom) {
    final byte[] buffer = new byte[16];
    _random.nextBytes(buffer);
    r1 = _toLong(buffer, 0);
    r2 = _toLong(buffer, 1);
  } else {
    r1 = _random.nextLong();
    r2 = _random.nextLong();
  }
  return UUIDUtil.constructUUID(UUIDType.RANDOM_BASED, r1, r2);
}
origin: org.apache.marmotta/kiwi-triplestore

/**
 * 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();
}
origin: apache/marmotta

/**
 * 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();
}
origin: longkerdandy/mithqtt

  /**
   * 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);
  }
}
origin: gentics/mesh

/**
 * 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));
}
origin: gentics/mesh

/**
 * 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;
}
com.fasterxml.uuid.implRandomBasedGenerator

Javadoc

Implementation of UUID generator that uses generation method 4.

Note on random number generation when using SecureRandom for random number generation: the first time SecureRandom object is used, there is noticeable delay between calling the method and getting the reply. This is because SecureRandom has to initialize itself to reasonably random state. Thus, if you want to lessen delay, it may be be a good idea to either get the first random UUID asynchronously from a separate thread, or to use the other generateRandomBasedUUID passing a previously initialized SecureRandom instance.

Most used methods

  • generate
  • <init>
  • _toInt
  • _toLong

Popular in Java

  • Making http requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • runOnUiThread (Activity)
  • setRequestProperty (URLConnection)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now