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

Parameter | Description
--- | ---
`values` | Source list.

Returns

One element selected uniformly from the list.

Throws

- ValueException if the list is null or empty.

Example

    import klyn.math

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