lenskit.basic.random#
Classes
|
|
|
Randomly select items from a candidate list. |
- class lenskit.basic.random.RandomConfig(*, n=None, rng=None)#
Bases:
BaseModel- Parameters:
- rng: int | Sequence[int] | None | Literal['user'] | tuple[int | Sequence[int] | None, Literal['user']]#
Random number generator configuration.
- model_config = {'arbitrary_types_allowed': True}#
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class lenskit.basic.random.RandomSelector(config=None, **kwargs)#
-
Randomly select items from a candidate list.
- Stability:
- Caller (see Stability Levels).
- Parameters:
n – The number of items to select, or
-1to randomly permute the items.rng – The random number generator or specification (see Random Seeds). This class supports derivable RNGs.
config (RandomConfig)