Skip to contents

Generate version 4 pseudo-random Universally Unique Identifiers (UUIDs).

Usage

generate_uuid(hint = NULL)

Source

Adapted from an unreleased version of uuid() from ids.

Arguments

hint

Optional character string or object coercible with as.character(), used as a random seed.

Value

A character string representing a valid UUID.

Details

This helper generates a UUID to identify generated theme versions.

References

Davis KR, Peabody B and Leach P (2024). "Universally Unique Identifiers (UUIDs)." RFC 9562. doi:10.17487/RFC9562 , https://www.rfc-editor.org/info/rfc9562.

See also

Package helpers: on_rstudio()

Examples

# Random UUID.
generate_uuid()
#> [1] "ac96cb3e-e465-4e2e-9ec3-e5c8c404fe17"

generate_uuid()
#> [1] "4e4c81bd-36aa-4d2a-84d4-2bbc2145febe"

# Persistent UUID with `hint`.
hint <- "something as seed"

generate_uuid(hint)
#> [1] "736f6d65-7468-496e-a720-617320736565"

generate_uuid(hint)
#> [1] "736f6d65-7468-496e-a720-617320736565"