polars.Series.shuffle#

Series.shuffle(seed: int | None = None) Series[source]#

Shuffle the contents of this Series.

Parameters:
seed

Seed for the random number generator. If set to None (default), a random seed is generated using the random module.

Examples

>>> s = pl.Series("a", [1, 2, 3])
>>> s.shuffle(seed=1)
shape: (3,)
Series: 'a' [i64]
[
        2
        1
        3
]