Created
August 10, 2023 13:52
-
-
Save rotaliator/ef7ef2cf2a1ebe89b113b1d0a4f2c01f to your computer and use it in GitHub Desktop.
Generates fixed length password
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 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