Created
May 4, 2020 18:57
-
-
Save tggreene/699185df598a6a41b886460cfa4e34c6 to your computer and use it in GitHub Desktop.
Get random bytes in clojure
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 urandom | |
[n] | |
(with-open [in (io/input-stream (io/file "/dev/urandom"))] | |
(let [buf (byte-array n) | |
_ (.read in buf)] | |
buf))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment