mirror of
https://github.com/3b1b/manim.git
synced 2025-11-14 09:57:48 +00:00
Add shuffled
This commit is contained in:
parent
a5f2ac689f
commit
4d67361800
1 changed files with 7 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
|||
from colour import Color
|
||||
|
||||
import numpy as np
|
||||
import random
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue