Add random id generator

This commit is contained in:
Marcus Kammer 2024-06-08 21:43:23 +02:00
parent ec139b644c
commit 1212925469
Signed by: marcuskammer
GPG key ID: C374817BE285268F

View file

@ -64,4 +64,11 @@
(get-universal-time) (get-universal-time)
(random 1000000)))) (random 1000000))))
(defun generate-random-id ()
(let ((charset "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
(length 11))
(coerce (loop repeat length
collect (char charset (random (length charset))))
'string)))
(defun string-empty-p (string) (= (length string) 0)) (defun string-empty-p (string) (= (length string) 0))