Hi!

In the std.uuid PHOBOS library doc I found:

    @trusted UUID randomUUID();
This function generates a random number based UUID from a random number generator.
    CTFE: This function is not supported at compile time.

Than trying a call like
    auto uuid = randomUUID()

results in an error message:
/usr/include/dmd/phobos/std/random.d(1138,10): Error: static variable seeded cannot be read at compile time

My understanding: randomUUID, which is available for runtime requires a variable from std.random, which is available only in compile time.
Sounds like a mathematical riddle, or?

Why I'm asking: I want to create class instances with an unique id as default.
But now that great idea seems to be a death end.

Anyone has an idea how to generate UUIDs in runtime?

Thanks & regards,
Ozan

Reply via email to