Skip to content

Instantly share code, notes, and snippets.

@joeljuca
Created July 7, 2021 23:59
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 joeljuca/9cfa77b2c19962bd3d5b0fb9e8517e27 to your computer and use it in GitHub Desktop.
Save joeljuca/9cfa77b2c19962bd3d5b0fb9e8517e27 to your computer and use it in GitHub Desktop.
defmodule Sorteio do
@moduledoc false
@people """
Fernando Collor
Fernando Henrique Cardoso
Luiz da Silva
"""
def people do
@people
|> String.split("\n")
|> Enum.map(&String.trim/1)
|> Enum.filter(&(String.length(&1) != 0))
end
def sortear do
people()
|> Enum.random()
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment