API Reference › Uuid › Uuid.v4
method

Uuid.v4

Uuid.v4() -> string

An explicit alias for Uuid.new: generates a **v4** (random) UUID in canonical lowercase text form. Use this spelling when the surrounding code also uses Uuid.v7 and naming both by version reads more clearly than new versus new_v7. The behaviour, entropy, and non-determinism caveat are identical to Uuid.new.

Example

program V4 {
  entry {
    let a = Uuid.v4()
    let b = Uuid.v4()
    if a != b { print(1) }   # two draws differ
  }
}
← All symbols