UUID.this

UUID V7 constructor

This implementation is not guaranteed to use a cryptographically secure PRNG. For more information please see: std.random.unpredictableSeed

  1. this(ubyte[16] uuidData)
  2. this(ubyte[16] uuidData)
  3. this(T uuidData)
  4. this(SysTime timestamp, ubyte[10] random)
  5. this(ulong epoch_msecs, ubyte[10] random)
    struct UUID
    @safe pure
    this
    (,
    ubyte[10] random = generateRandomData!10
    )
  6. this(T[] uuid)

Parameters

random ubyte[10]

UUID V7 has 74 bits of random data, which rounds to 10 ubyte's. If no random data is given, random data is generated.

Examples

import std.datetime : DateTime, SysTime;
SysTime st = DateTime(2025, 8, 19, 10, 38, 45);
UUID u = UUID(st);
SysTime o = u.v7Timestamp();
assert(o == st, st.toString() ~ " | " ~ o.toString());

Meta