defmodule Faker do def format(str) when is_binary(str) do format(str, "") end defp format(<<"#" :: utf8, tail :: binary>>, "") do format(tail, "#{:crypto.rand_uniform(1, 10)}") end defp format(<<"#" :: utf8, tail :: binary>>, acc) do format(tail, <>) end defp format(<<"?" :: utf8, tail :: binary>>, acc) do format(tail, <>) end defp format(<>, acc) do format(tail, <>) end defp format("", acc) do acc end defp letter do alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' Enum.at(alphabet, :crypto.rand_uniform(0, Enum.count(alphabet))) end def locale do Application.get_env(:faker, :locale) end def locale(lang) when is_atom(lang) do Application.put_env(:faker, :locale, lang) end end