psychopy_ext.exp.weighted_choice

psychopy_ext.exp.weighted_choice(choices=None, weights=None)[source]

Chooses an element from a list based on it’s weight.

Kwargs:
  • choices (list, default: None)

    If None, an index between 0 and len(weights) is returned.

  • weights (list, default: None)

    If None, all choices get equal weights.

Returns:

An element from choices