Last active
August 29, 2015 14:10
-
-
Save pgaertig/d378aaeccfea3a0e2fe4 to your computer and use it in GitHub Desktop.
Random URL safe string generation in Clojure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn rand-url-str [len] | |
(let [chars (concat (range 48 58) (range 97 123))] | |
(apply str (repeatedly len #(char (rand-nth chars)))))) | |
(rand-url-str 12) | |
; => "ypua82wote07" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment