mirror of
https://github.com/penpot/penpot.git
synced 2025-07-20 08:07:14 +02:00
Add uuid generation functions that uses high quality RNG.
This commit is contained in:
parent
5f86df81ec
commit
6e4d243897
3 changed files with 116 additions and 0 deletions
25
vendor/uuid/core.cljs
vendored
Normal file
25
vendor/uuid/core.cljs
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uuid.core
|
||||
"Provides a UUID v4 uuid generation.
|
||||
|
||||
In difference with builtin `random-uuid` function this
|
||||
implementation tries to use high quality RNG if is
|
||||
available (browser crypto object or nodejs crypto module).
|
||||
|
||||
If no high qualiry RNG, switches to the default Math based
|
||||
RNG with proper waring in the console."
|
||||
(:require [uuid.impl :as impl]))
|
||||
|
||||
(defn v4
|
||||
"Generate a v4 (random) UUID."
|
||||
[]
|
||||
(uuid (impl/v4)))
|
||||
|
||||
(def random
|
||||
"Alias for `uuid.core/v4`."
|
||||
v4)
|
Loading…
Add table
Add a link
Reference in a new issue