Navigation
Synopsis Pick a random element from a list.
Function &T getOneFrom(list[&T] lst)
Usage import List;
Description Get an arbitrary element from a list. See takeOneFrom for a function that also removes the selected element.
Examples
rascal>import List;
ok
rascal>getOneFrom(["zebra", "elephant", "snake", "owl"]);
str: "owl"
rascal>getOneFrom(["zebra", "elephant", "snake", "owl"]);
str: "snake"
rascal>getOneFrom(["zebra", "elephant", "snake", "owl"]);
str: "zebra"

Questions
Question [1].
The type of getOneFrom([16]) is



Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.