Created
October 30, 2014 22:12
-
-
Save kordano/d5c5141f21014359cf1d to your computer and use it in GitHub Desktop.
Random string of length n
This file contains 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 random-string [n] | |
(let [chars (map char (concat (range 48 58) (range 65 91) (range 97 123)))] | |
(apply str (take n (repeatedly #(rand-nth chars)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment