Commit ed9483a7 authored by Kisaragi Hiu's avatar Kisaragi Hiu

Add common lisp version of random-string and add extension to the racket version

parent f0cbc183
#!/usr/bin/env clisp
; vim: filetype=lisp
; random-string [length]
(defvar *charset* "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
(defun select-random-item (seq)
(elt seq (random (length seq)
;; create a newly randomly seeded random state
(make-random-state t))))
(defun random-string (&optional (len 16))
(map 'string
(lambda (x) (select-random-item *charset*))
(make-string len)))
(format t (if *args*
(random-string (parse-integer (first *args*)))
(random-string)))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment