Skip to content

Instantly share code, notes, and snippets.

@pgaertig pgaertig/rand-url-str.clj
Last active Aug 29, 2015

What would you like to do?
Random URL safe string generation in Clojure
(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
You can’t perform that action at this time.