Skip to content

Commit

Permalink
Add shuffled
Browse files Browse the repository at this point in the history
  • Loading branch information
3b1b committed Mar 7, 2024
1 parent a5f2ac6 commit 4d67361
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions manimlib/utils/iterables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from colour import Color

import numpy as np
import random

from typing import TYPE_CHECKING

Expand Down Expand Up @@ -83,6 +84,12 @@ def listify(obj: object) -> list:
return [obj]


def shuffled(iterable: Iterable) -> list:
as_list = list(iterable)
random.shuffle(as_list)
return as_list


def resize_array(nparray: np.ndarray, length: int) -> np.ndarray:
if len(nparray) == length:
return nparray
Expand Down

0 comments on commit 4d67361

Please sign in to comment.