Class AbstRandomBasedFactory

    • 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.
        Specified by:
        create in interface NoArgsFactory
        Returns:
        a random-based UUID
      • getRandomFunction

        protected static RandomFunction getRandomFunction​(Random random)
        It instantiates a function that returns a byte array of a given length. If the a null parameter is given, DefaultRandomFunction is implied.
        Parameters:
        random - a Random generator
        Returns:
        a random function that returns a byte array of a given length