Class RandomBasedFactory

  • All Implemented Interfaces:
    NoArgsFactory

    public final class RandomBasedFactory
    extends AbstRandomBasedFactory
    Concrete factory for creating random-based unique identifiers (UUIDv4).
    • Constructor Detail

      • RandomBasedFactory

        public RandomBasedFactory()
      • RandomBasedFactory

        public RandomBasedFactory​(Random random)
      • RandomBasedFactory

        public RandomBasedFactory​(LongSupplier randomSupplier)
      • RandomBasedFactory

        public RandomBasedFactory​(IntFunction<byte[]> randomFunction)
    • Method Detail

      • create

        public UUID create()
        Returns a random-based UUID. ### RFC-4122 - 4.4. Algorithms for Creating a UUID from Truly Random or Pseudo-Random Numbers (1) Set the two most significant bits (bits 6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively. (2) Set the four most significant bits (bits 12 through 15) of the time_hi_and_version field to the 4-bit version number from Section 4.1.3. (3) Set all the other bits to randomly (or pseudo-randomly) chosen values.
        Returns:
        a random-based UUID