This factory holds a static method to build UUIDs.

As UUIDs strongly rely on random numbers, a random number generation method is also provided.


Factories

Constructors

Methods

  • Generates a random number in the range [0,1[.

    Depending on your platform, the function may use cryptographic functions or use Math.random.

    Returns number

    A random number in the range [0,1[.

  • Generates an new UUID string in the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx if pFormatted or xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx if not pFormatted where x is in the set [0-9a-f].

    Parameters

    • pFormatted: boolean
      in
      If true, the uuid string will contain "-".

    Returns string

    A random UUID string.