Returns a random v4 UUID of the form
xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx, where each
x is replaced with a random hexadecimal digit from 0 to f, and
y is replaced with a random hexadecimal digit from 8 to b.
There's also @LeverOne's approach using iteration, which is one byte shorter.
@jed thanks for the link. I browsed through that spec to see if I could find something that jumps out. I see lots of discussion of bits in fields and such, but nothing that obviously connects digits 0, 1, and 8 to needing to be replaced. In fact, the part you linked to specifically says:
In any case, appreciate having further info. My understanding is still incomplete, but it's less incomplete now. ;-)