U
    ˆ±ËhP  ã                   @  s†  d dl mZ d dlZd dlmZmZmZ d dlZ	erTd dl
mZ ddlmZmZmZ ddœd	d
„Zddœdd„ZdAddddddœdd„ZdBdddddœdd„Zddœdddddddœdd „Zddœdddddddœd!d"„ZdCdddddd#œd$d%„ZdDdddd&d'œd(d)„ZdEd*ddd+œd,d-„Zdde	jdfd&d.dd/dd&d0œd1d2„ZdFd3ddd4œd5d6„ZdGdd8d9d:ddd;œd<d=„ZdHdddd>œd?d@„ZdS )Ié    )ÚannotationsN)ÚTYPE_CHECKINGÚAnyÚSequence)Ú	DTypeLikeé   )ÚFloatNumTypeÚ
IntNumTypeÚNumTypeÚint)Úreturnc                   C  s   t  dd¡S )Nr   l   ÿÿ )Ú	py_randomÚrandint© r   r   ú?/tmp/pip-unpacked-wheel-e8onvpoz/albumentations/random_utils.pyÚget_random_seed   s    r   znp.random.RandomStatec                   C  s   t j tƒ ¡S ©N)ÚnpÚrandomZRandomStater   r   r   r   r   Úget_random_state   s    r   ç        ç      ð?r
   ztuple[int, ...] | int | Noneznp.random.RandomState | Noner   )ÚlowÚhighÚsizeÚrandom_stater   c                 C  s   |d krt ƒ }| | ||¡S r   )r   Úuniform)r   r   r   r   r   r   r   r      s    r   ç      à?)ÚalphaÚbetar   r   c                 C  s   |d krt ƒ }| | |¡S r   )r   r   )r   r   r   r   r   r   r   !   s    r   )r   r   z
np.ndarray)Úd0Úd1Úmorer   Úkwargsr   c                O  s"   |d krt ƒ }|j| |f|ž|ŽS r   )r   Úrand©r    r!   r   r"   r#   r   r   r   r$   +   s    r$   c                O  s"   |d krt ƒ }|j| |f|ž|ŽS r   )r   Úrandnr%   r   r   r   r&   7   s    r&   )ÚlocÚscaler   r   r   c                 C  s   |d krt ƒ }| | ||¡S r   )r   Únormal)r'   r(   r   r   r   r   r   r)   C   s    r)   r	   )Úlamr   r   r   c                 C  s   |d krt ƒ }| | |¡S r   )r   Úpoisson)r*   r   r   r   r   r   r+   N   s    r+   z"int | Sequence[float] | np.ndarray)Úxr   r   c                 C  s   |d krt ƒ }| | ¡S r   )r   Úpermutation)r,   r   r   r   r   r-   X   s    r-   zIntNumType | Noner   )r   r   r   Údtyper   r   c                 C  s   |d krt ƒ }| | |||¡S r   )r   r   )r   r   r   r.   r   r   r   r   r   a   s    r   zNumType | None)r   r   r   c                 C  s   |d krt ƒ }| | ¡S r   )r   r   )r   r   r   r   r   r   m   s    r   Tztuple[int, int] | int | NoneÚboolz#Sequence[float] | np.ndarray | None)Úar   ÚreplaceÚpr   r   c                 C  s   |d krt ƒ }| | |||¡S r   )r   Úchoice)r0   r   r1   r2   r   r   r   r   r3   s   s    r3   )r0   r   r   c                 C  s   |dkrt ƒ }| | ¡ | S )a•  Shuffles an array in-place, using a specified random state or creating a new one if not provided.

    Args:
        a (np.ndarray): The array to be shuffled.
        random_state (Optional[np.random.RandomState], optional): The random state used for shuffling. Defaults to None.

    Returns:
        np.ndarray: The shuffled array (note: the shuffle is in-place, so the original array is modified).
    N)r   Úshuffle)r0   r   r   r   r   r4      s    
r4   )r   r   NN)r   r   N)r   r   NN)r   NN)N)NN)NTNN)N)Ú
__future__r   r   r   Útypingr   r   r   Znumpyr   Znumpy.typingr   Z
core.typesr   r	   r
   r   r   r   r   r$   r&   r)   r+   r-   Zint32r   r3   r4   r   r   r   r   Ú<module>   sZ       ü   ýüü    ü   ý þû    û þ