choice#

class choice(a=2, p=None, **kwargs)[source]#

Bases: Dist

Random choice between discrete options (note: dynamic parameters not supported)

Parameters:
  • a (int or array) – the number of choices, or the choices themselves (default 2)

  • p (array) – if supplied, the probability of each choice (default, 1/a for a choices)

Examples:

# Simulate 10 die rolls
ss.choice(6, strict=False)(10) + 1

# Choose between specified options each with a specified probability (must sum to 1)
ss.choice(a=[30, 70], p=[0.3, 0.7], strict=False)(10)

Note: although Bernoulli trials can be generated using a=2, it is much faster to use ss.bernoulli() instead.

Attributes

bitgen

state

Get the current state

state_int

Get the integer corresponding to the current state

Methods

ppf(rands)[source]#

Shouldn’t actually be needed since dynamic pars not supported

preprocess_timepar(key, timepar)[source]#

Not valid since does not scale with time