diff options
Diffstat (limited to 'src/lib/uuid.js')
-rw-r--r-- | src/lib/uuid.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/uuid.js b/src/lib/uuid.js new file mode 100644 index 0000000..d809437 --- /dev/null +++ b/src/lib/uuid.js @@ -0,0 +1,6 @@ +'use strict'; +function uuid() { + return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, + c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4) + .toString(16)); +} |