Packages

I am playing with publishing a package.

Current section

Files

Jump to
playground src winner.erl
Raw

src/winner.erl

-module(winner).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([choose_winner/0]).
-file("/Users/bradleymehder/Developer/Frameworks/Gleam/playground/src/winner.gleam", 9).
-spec choose_winner() -> binary().
choose_winner() ->
Random_index = gleam@int:random(
erlang:length(
[<<"Lando"/utf8>>,
<<"Lance"/utf8>>,
<<"Lewis"/utf8>>,
<<"Max"/utf8>>,
<<"Alex"/utf8>>,
<<"Franco"/utf8>>,
<<"Kevin"/utf8>>,
<<"Oscar"/utf8>>]
)
),
Chosen_winner = begin
_pipe = gleam@iterator:from_list(
[<<"Lando"/utf8>>,
<<"Lance"/utf8>>,
<<"Lewis"/utf8>>,
<<"Max"/utf8>>,
<<"Alex"/utf8>>,
<<"Franco"/utf8>>,
<<"Kevin"/utf8>>,
<<"Oscar"/utf8>>]
),
gleam@iterator:at(_pipe, Random_index)
end,
case Chosen_winner of
{ok, Winner} ->
Winner;
{error, nil} ->
<<"No winner found"/utf8>>
end.