randmax#

statrl.settings.utils.randmax(A)[source]#

Index of a maximum of A, breaking ties uniformly at random.

Parameters:

A (ndarray) – Array of values to maximize over.

Returns:

Index of a maximal entry. When several entries attain the maximum, one of them is drawn uniformly at random.

Return type:

int

See also

randmin

The minimizing counterpart.

Examples

>>> import numpy as np
>>> randmax(np.array([0.1, 0.7, 0.3]))
1