choose#

choose(policy, uniform)[source]#

Sample an option from a policy, given a uniform random number in [0, 1).

This is the inverse-CDF step of numpy.random.choice(len(policy), p=policy), which is how the choice() methods of the decision classes sample. With uniform = numpy.random.random_sample(), it returns the option numpy.random.choice would have returned, so simulations can draw all uniforms with NumPy before a compiled loop and still be reproducible with numpy.random.seed, and identical to the per-trial models.