Skip to content

Instantly share code, notes, and snippets.

@kocubinski
Created July 13, 2018 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kocubinski/c81d4140e10065bc7866e0dca0b1d2d1 to your computer and use it in GitHub Desktop.
Save kocubinski/c81d4140e10065bc7866e0dca0b1d2d1 to your computer and use it in GitHub Desktop.
generate random words
(ns moon-moon.core
(:require [clojure.java.io :as io]
[clojure.string :as str]))
(defn rand-words
[]
(with-open [reader (io/reader "/usr/share/dict/words")]
(->> (line-seq reader)
(filter (partial re-matches #"[a-z]{0,7}"))
(partial rand-nth)
(repeatedly 2)
(str/join "-"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment