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.
Oh, wait... I think I maybe get more of it now... the code has stuff like
1e3
and8e3
, which are like1000
and8000
... but it also has4e3
... so basically it's targeting all the 1s, 0s, and 8s for replacement, but leaving the4
in the middle alone.