Skip to content

Instantly share code, notes, and snippets.

@rotaliator
Created August 10, 2023 13:52
Show Gist options
  • Save rotaliator/ef7ef2cf2a1ebe89b113b1d0a4f2c01f to your computer and use it in GitHub Desktop.
Save rotaliator/ef7ef2cf2a1ebe89b113b1d0a4f2c01f to your computer and use it in GitHub Desktop.
Generates fixed length password
(defn fixed-length-password
([] (fixed-length-password 20))
([n]
(let [chars (map char (concat (range 48 58) (range 65 91) (range 97 123)))
password (repeatedly n #(rand-nth chars))]
(reduce str password))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment