klyn.math.Random.choice
method
public static choice<T>(values as IList<T>) as T:
Description

Returns a random element from a non-empty read-only list.

Parameters
ParameterDescription
valuesSource list.
Returns

One element selected uniformly from the list.

Throws
  • ValueError if the list is null or empty.
Example
import klyn.math

color = Random.choice(["red", "green", "blue"])
print(color)