cue-lang / docs-and-content

A place to discuss, plan, and track documentation on cuelang.org
6 stars 1 forks source link

docs/howto: Generating a random UUID #110

Open jpluscplusm opened 8 months ago

jpluscplusm commented 8 months ago

Slack thread: https://cuelang.slack.com/archives/CLT4FD7KP/p1708980558122439?thread_ts=1708969062.779309&cid=CLT4FD7KP

exec cue export -T file.cue
-- file.cue --
import "uuid"

#seed: uint128 @tag(seed,var=rand)
u:     uuid.FromInt(#seed)

NB make sure the lack of UUID stability is made very clear to the reader!

Extension: deriving multiple random UUID from the one initial seed?