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.
Instance, based on recursion, can be found here.
@LeverOne,
-
operator should be faster than^
(and it is, for about 10% in node.js).^
uses Double ↔ Int32 conversion twice thus making significant overhead.UPD: I was wrong,
^
is faster indeed in IE9. There's no visible difference between^
and-
cases in other browsers.