diff options
Diffstat (limited to 'src/util.lisp')
-rw-r--r-- | src/util.lisp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/util.lisp b/src/util.lisp index cee463f..0bbf585 100644 --- a/src/util.lisp +++ b/src/util.lisp @@ -373,6 +373,14 @@ expansion as a starting point for your own DEFPACKAGE form for your consfig." "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" :test #'string=) +(defun random-alphanumeric (length) + "Return a random alphanumeric string of length LENGTH." + (aprog1 (make-string length) + (loop with *random-state* = (make-random-state t) + for i below length + do (setf (char it i) + (char +alphanum+ (random #.(length +alphanum+))))))) + (defun mkfifo () "Use mkfifo(3) to create a named pipe with a mkstemp(3)-like name." (let* ((dir (drop-trailing-slash (or (getenv "TMPDIR") "/tmp"))) |