Packages

Is a random word generator dictionary used to create hangman game

Current section

Files

Jump to
dictionary_johnson lib impl words.ex
Raw

lib/impl/words.ex

defmodule Dictionary.Impl.Words do
@type t :: list(String)
@spec word_list() :: t
def word_list do
"../../assets/word.txt"
|> Path.expand(__DIR__)
|> File.read!()
|> String.split(~r{\n}, trim: true)
end
def generate_random(word_list) do
word_list |> Enum.random()
end
end