# UUIDs

`UUIDs.uuid1` — Function

    uuid1([rng::AbstractRNG]) -> UUID

Generates a version 1 (time-based) universally unique identifier (UUID), as specified by RFC 4122. Note that the Node ID is randomly generated (does not identify the host) according to section 4.5 of the RFC.

The default rng used by `uuid1` is not `GLOBAL_RNG` and every invocation of `uuid1()` without an argument should be expected to return a unique identifier. Importantly, the outputs of `uuid1` do not repeat even when `Random.seed!(seed)` is called. Currently (as of Julia 1.6), `uuid1` uses `Random.RandomDevice` as the default rng. However, this is an implementation detail that may change in the future.

Julia 1.6

The output of `uuid1` does not depend on `GLOBAL_RNG` as of Julia 1.6.

Examples

    julia> rng = MersenneTwister(1234);

    julia> uuid1(rng)
    UUID("cfc395e8-590f-11e8-1f13-43a2532b2fa8")

source
`UUIDs.uuid4` — Function

    uuid4([rng::AbstractRNG]) -> UUID

Generates a version 4 (random or pseudo-random) universally unique identifier (UUID), as specified by RFC 4122.

The default rng used by `uuid4` is not `GLOBAL_RNG` and every invocation of `uuid4()` without an argument should be expected to return a unique identifier. Importantly, the outputs of `uuid4` do not repeat even when `Random.seed!(seed)` is called. Currently (as of Julia 1.6), `uuid4` uses `Random.RandomDevice` as the default rng. However, this is an implementation detail that may change in the future.

Julia 1.6

The output of `uuid4` does not depend on `GLOBAL_RNG` as of Julia 1.6.

Examples

    julia> rng = MersenneTwister(1234);

    julia> uuid4(rng)
    UUID("7a052949-c101-4ca3-9a7e-43a2532b2fa8")

source
`UUIDs.uuid5` — Function

    uuid5(ns::UUID, name::String) -> UUID

Generates a version 5 (namespace and domain-based) universally unique identifier (UUID), as specified by RFC 4122.

Julia 1.1

This function requires at least Julia 1.1.

Examples

    julia> rng = MersenneTwister(1234);

    julia> u4 = uuid4(rng)
    UUID("7a052949-c101-4ca3-9a7e-43a2532b2fa8")

    julia> u5 = uuid5(u4, "julia")
    UUID("086cc5bb-2461-57d8-8068-0aed7f5b5cd1")

source
`UUIDs.uuid_version` — Function

    uuid_version(u::UUID) -> Int

Inspects the given UUID and returns its version (see RFC 4122).

Examples

    julia> uuid_version(uuid4())
    4

source

Theme

This document was generated with Documenter.jl on Sunday 12 September 2021. Using Julia version 1.7.0-rc1.