Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;; Password generator
- (import :gerbil/gambit)
- (export main)
- (def (random-char str)
- (string-ref str (random-integer (string-length str))))
- (def (password size dict result)
- (cond
- ((equal? size 0)
- (list->string result))
- (else
- (password (1- size)
- dict
- (cons (random-char dict) result)))))
- (def (main . args)
- (display "Number: ")
- (let ((n (read))
- (dict (string-append "qwertyuiopasdfghjkzxcvbnm"
- "QWERTYUPASDFGHJKLZXCVBNM"
- "<>?,./1234567890!@#$%^&*"
- "()-_=+*")))
- (displayln "Password: " (password n dict []))))
Add Comment
Please, Sign In to add comment