egttools.numerical.numerical_.sample_simplex_directly¶
- sample_simplex_directly()¶
Samples a discrete population state uniformly at random from the simplex.
This method uses a direct sampling approach to draw a single composition of strategies such that the total population size is preserved.
- Parameters:
- Returns:
A vector of length nb_strategies, where each entry indicates how many individuals adopt the corresponding strategy.
- Return type:
NDArray[np.int64]
Examples
>>> sample_simplex_directly(3, 10) array([3, 4, 3])
>>> sample_simplex_directly(2, 5) array([2, 3])