Skip to content

Instantly share code, notes, and snippets.

@pgaertig
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgaertig/d378aaeccfea3a0e2fe4 to your computer and use it in GitHub Desktop.
Save pgaertig/d378aaeccfea3a0e2fe4 to your computer and use it in GitHub Desktop.
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