Add shuffled

This commit is contained in:
Grant Sanderson 2024-03-07 08:40:19 -03:00
parent a5f2ac689f
commit 4d67361800

View file

@ -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