Current section

Files

Jump to
blah src blah@utils.erl
Raw

src/blah@utils.erl

-module(blah@utils).
-compile(no_auto_import).
-export([get_random_item/1]).
-spec get_random_item(list(ENP)) -> ENP.
get_random_item(Given_list) ->
Max_index = gleam@list:length(Given_list),
Index = gleam@int:random(0, Max_index),
{ok, Item@1} = case gleam@list:at(Given_list, Index) of
{ok, Item} -> {ok, Item};
_try ->
erlang:error(#{gleam_error => assert,
message => <<"Assertion pattern match failed"/utf8>>,
value => _try,
module => <<"blah/utils"/utf8>>,
function => <<"get_random_item"/utf8>>,
line => 7})
end,
Item@1.