Add urandom function
This commit is contained in:
parent
11319dfe20
commit
e2f13a1c58
@ -126,4 +126,12 @@
|
||||
(use-package shut-up
|
||||
:commands (shut-up))
|
||||
|
||||
(defun urandom (len)
|
||||
"Generate a random string of length LEN using /dev/urandom."
|
||||
(interactive "nLength: ")
|
||||
(let ((rand (shell-command-to-string (format "head -c %d /dev/urandom | base64" len))))
|
||||
(when (called-interactively-p 'any)
|
||||
(kill-new (message rand)))
|
||||
rand))
|
||||
|
||||
(provide 'init-lib)
|
||||
|
Loading…
Reference in New Issue
Block a user