AlkantarClanX12

Your IP : 18.118.119.77


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/random.cpython-310.opt-2.pyc

o

6��fŁ�@s	ddlmZddlmZmZmZ	m
ZmZ
ddlmZmZmZmZddlmZmZmZddlmZddlm Z!m"Z#ddl$m%Z&ddl'm(Z)m*Z+dd	l,m,Z-dd
lZ.dd
l/Z/zddl0m1Z0Wne2ylddl3m1Z0Ynwgd�Z4d
ed�ed�Z5ed�Z6ded�Z7dZ8de8Z9dZ:Gdd�de/j;�Z;Gdd�de;�Z<e;�Z=e=j>Z>e=j?Z?e=j@Z@e=jAZAe=jBZBe=jCZCe=jDZDe=jEZEe=jFZFe=jGZGe=jHZHe=jIZIe=jJZJe=jKZKe=jLZLe=jMZMe=jNZNe=jOZOe=jPZPe=jQZQe=jRZRe=jSZSe=jTZTdd�ZUd"dd�ZVeWe.d�r�e.jXe=j>d �eYd!k�reV�d
Sd
S)#�)�warn)�log�exp�pi�e�ceil)�sqrt�acos�cos�sin)�tau�floor�isfinite)�urandom)�Set�Sequence)�index)�
accumulate�repeat)�bisectN)�sha512)�Random�SystemRandom�betavariate�choice�choices�expovariate�gammavariate�gauss�getrandbits�getstate�lognormvariate�
normalvariate�
paretovariate�	randbytes�randint�random�	randrange�sample�seed�setstate�shuffle�
triangular�uniform�vonmisesvariate�weibullvariate�g��@�@��?�@�5��cs,eZdZ	dZdAdd�ZdB�fdd�	Z�fdd	�Z�fd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zde
>fdd�ZeZdd�Zdefdd�Zdd�Zdd �ZdAd!d"�Zdd#�d$d%�ZdAddd&�d'd(�Zd)d*�ZdCd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"�Z#S)Dr�NcCs	|�|�d|_dS�N)r)�
gauss_next)�self�x�r=�-/opt/alt/python310/lib64/python3.10/random.py�__init__ws

zRandom.__init__r6cs	|dkrCt|ttf�rCt|t�r|�d�n|}|r"t|d�d>nd}tt|�D]
}d||Ad@}q)|t|�N}|dkr@dn|}n5|d	kret|tttf�ret|t�rX|��}t	�
|t|���d
�}nt|t
d�t	ttttf�sxtdtd	�t��|�d|_dS)Nr7zlatin-1r�iCBl����������r6�bigz�Seeding based on hashing is deprecated
since Python 3.9 and will be removed in a subsequent version. The only 
supported seed types are: None, int, float, str, bytes, and bytearray.)�
isinstance�str�bytes�decode�ord�map�len�	bytearray�encode�int�
from_bytes�_sha512Zdigest�type�float�_warn�DeprecationWarning�superr)r:)r;�a�versionr<�c��	__class__r=r>r)�s$
�
zRandom.seedcs	|jt���|jfSr9)�VERSIONrTr r:�r;rXr=r>r ��zRandom.getstatec
s�	|d}|dkr|\}}|_t��|�dS|dkrD|\}}|_ztdd�|D��}Wnty;}zt|�d}~wwt��|�dStd||jf��)Nrr8r6css�|]}|dVqdS)lNr=)�.0r<r=r=r>�	<genexpr>�s�z"Random.setstate.<locals>.<genexpr>z?state with version %s passed to Random.setstate() of version %s)r:rTr*�tuple�
ValueError�	TypeErrorrZ)r;�staterVZ
internalstaterrXr=r>r*�s"���zRandom.setstatecCs|��Sr9)r r[r=r=r>�__getstate__�szRandom.__getstate__cCs|�|�dSr9)r*)r;rbr=r=r>�__setstate__�szRandom.__setstate__cCs|jd|��fS)Nr=)rYr r[r=r=r>�
__reduce__�szRandom.__reduce__cKsR	|jD]"}d|jvrdSd|jvr|j|_dSd|jvr&|j|_dSqdS)N�
_randbelowrr&)�__mro__�__dict__�_randbelow_with_getrandbitsrf�_randbelow_without_getrandbits)�cls�kwargsrWr=r=r>�__init_subclass__�s



��zRandom.__init_subclass__cCs<	|sdS|j}|��}||�}||kr||�}||ks|S)Nr)r�
bit_length)r;�nr�k�rr=r=r>ri�s�z"Random._randbelow_with_getrandbitsr7cCsr	|j}||krtd�t|�|�S|dkrdS||}|||}|�}||kr1|�}||ks*t||�|S)Nz�Underlying random() generator does not supply 
enough bits to choose from a population range this large.
To remove the range limitation, add a getrandbits() method.r)r&rR�_floor)r;ro�maxsizer&Zrem�limitrqr=r=r>rj�s�z%Random._randbelow_without_getrandbitscCs	|�|d��|d�S)N��little)r�to_bytes�r;ror=r=r>r$szRandom.randbytesc	Cs�	zt|�}Wn!ty(t|�}||kr tdtd�td��tdtd�Ynw|durB|tur5td��|dkr>|�|�Std��zt|�}Wn!tyit|�}||kratdtd�td��tdtd�Ynw||}zt|�}Wn!ty�t|�}||kr�tdtd�td	��tdtd�Ynw|d
kr�|dkr�||�|�Std|||f��|dkr�||d
|}n|dkr�||d
|}ntd��|dkr�td��|||�|�S)
Nz.randrange() will raise TypeError in the futurer6z!non-integer arg 1 for randrange()zwnon-integer arguments to randrange() have been deprecated since Python 3.10 and will be removed in a subsequent versionz Missing a non-None stop argumentrzempty range for randrange()z non-integer stop for randrange()z non-integer step for randrange()r7z(empty range for randrange() (%d, %d, %d)zzero step for randrange())�_indexrarMrRrSr`�_ONErf)	r;�start�stop�stepZistartZistop�widthZistepror=r=r>r'$sv	���

���
���zRandom.randrangecCs	|�||d�S)Nr7)r'�r;rU�br=r=r>r%nszRandom.randintcCs	||�t|��Sr9)rfrJ)r;�seqr=r=r>rwsz
Random.choicecCs�	|dur)|j}ttdt|���D]}||d�}||||||<||<qdStdtd�t}ttdt|���D]}||�|d�}||||||<||<q:dS)Nr7zuThe *random* parameter to shuffle() has been deprecated
since Python 3.9 and will be removed in a subsequent version.r6)rf�reversed�rangerJrRrSrr)r;r<r&�	randbelow�i�jr
r=r=r>r+|s���zRandom.shuffle)�countscs�	t�t�st�t�rtdtd�t���ntd��t��}|dur]tt	|���t��|kr2t
d�����}t|t�s?td��|dkrGt
d��|j
t|�|d�}t����fd	d
�|D�S|j}d|krm|ksrt
d��t
d��dg|}d}	|d
kr�|	dtt|dd��7}	||	kr�t��}
t|�D]}|||�}|
|||<|
||d|
|<q�|St�}
|
j}t|�D]}||�}||
vr�||�}||
vs�||��|||<q�|S)Nz\Sampling from a set deprecated
since Python 3.9 and will be removed in a subsequent version.r6zAPopulation must be a sequence.  For dicts or sets, use sorted(d).z2The number of counts does not match the populationzCounts must be integersrz)Total of counts must be greater than zero)rpcsg|]	}���|��qSr=r=)r]�s�rZ
cum_counts�
populationr=r>�
<listcomp>�sz!Random.sample.<locals>.<listcomp>z,Sample larger than population or is negative��r0r8r7)rD�	_Sequence�_SetrRrSr_rarJ�list�_accumulater`�poprMr(r��_bisectrf�_ceil�_log�set�add)r;r�rpr�ro�totalZ
selectionsr��resultZsetsizeZpoolr�r�ZselectedZselected_addr=r�r>r(�s^
4
�

�

��z
Random.sample)�cum_weightsrpcs	|j�t����durE|dur%t��d7�����fdd�td|�D�Sztt|���WntyDt|t�s:�|}td|���d�w|durMtd��t���krWt	d���dd��dkret	d��t
��smt	d	��t��d
�������fdd�td|�D�S)N�csg|]}�������qSr=r=�r]r�)r
ror�r&r=r>r�sz"Random.choices.<locals>.<listcomp>z4The number of choices must be a keyword argument: k=z2Cannot specify both weights and cumulative weightsz3The number of weights does not match the populationrAz*Total of weights must be greater than zerozTotal of weights must be finiter7cs$g|]}������d���qS)rr=r�)rr��hir�r&r�r=r>r�s�)r&rJrr�_repeatr�r�rarDrMr`�	_isfiniter�)r;r�Zweightsr�rpr=)rr�r
r�ror�r&r�r>r�sD
����zRandom.choicescCs	||||��Sr9�r&rr=r=r>r-"r\zRandom.uniformr�r3cCs|	|��}z|durdn||||}Wnty |YSw||kr2d|}d|}||}}|||t||�S)N��?r3)r&�ZeroDivisionError�_sqrt)r;�low�high�mode�urWr=r=r>r,&s �
zRandom.triangularcCsT	|j}	|�}d|�}t|d|}||d}|t|�kr#nq|||S)NTr3r�r2)r&�
NV_MAGICCONSTr�)r;�mu�sigmar&�u1�u2�zZzzr=r=r>r":s

�zRandom.normalvariatecCsb	|j}|j}d|_|dur+|�t}tdtd|���}t|�|}t|�||_|||S)Ng�r3)r&r:�TWOPIr�r��_cos�_sin)r;r�r�r&r�Zx2piZg2radr=r=r>rOs
zRandom.gausscCs	t|�||��Sr9)�_expr")r;r�r�r=r=r>r!uszRandom.lognormvariatecCs	td|���|S�Nr3)r�r&)r;Zlambdr=r=r>rszRandom.expovariatecCs�	|j}|dkr
t|�Sd|}|td||�}	|�}tt|�}|||}|�}	|	d||ks@|	d|t|�krAnqd|}
|
|d|
|}|�}|dkra|t|�t}
|
S|t|�t}
|
S)Ng���ư>r�r3)r&r�r�r��_pir��_acos)r;r�Zkappar&r�rqr�r��dr��q�fZu3Zthetar=r=r>r.�s,
$�	�zRandom.vonmisesvariatecCs|	|dks	|dkr
td��|j}|dkrltd|d�}|t}||}	|�}d|kr2dks4nq$d|�}t|d|�|}	|t|	�}
|||}|||	|
}|td|dksg|t|�krk|
|Sq%|dkrztd|��|S	|�}
t|t}||
}|dkr�|d|}
n	t|||�}
|�}|dkr�||
|dkr�	|
|Sn|t|
�kr�	|
|Sq{)	Nr�z*gammavariate: alpha and beta must be > 0.0r3r1TgH�����z>g�P���?r4)r`r&r��LOG4r�r��
SG_MAGICCONST�_e)r;�alpha�betar&ZainvZbbbZcccr�r��vr<r�rqr�r��pr=r=r>r�sN
 ���zRandom.gammavariatecCs*	|�|d�}|r|||�|d�SdS)Nr3r�)r)r;r�r��yr=r=r>r�s
zRandom.betavariatecCs	d|��}|d|S)Nr3g�r�)r;r�r�r=r=r>r#szRandom.paretovariatecCs$	d|��}|t|�d|Sr�)r&r�)r;r�r�r�r=r=r>r/szRandom.weibullvariater9)Nr6)r�r3N)$�__name__�
__module__�__qualname__rZr?r)r r*rcrdrermri�BPFrjrfr$rzr'r%rr+r(rr-r,r"rr!rr.rrr#r/�
__classcell__r=r=rXr>rgs@
	*!
J	
d(
&
*Arc@s>eZdZ	dd�Zdd�Zdd�Zdd�Zd	d
�ZeZZ	dS)rcCs	t�td�d�d?tS)Nr@rCr8)rMrN�_urandom�	RECIP_BPFr[r=r=r>r&6szSystemRandom.randomcCs>	|dkr	td��|dd}t�t|�d�}||d|?S)Nrz#number of bits must be non-negativer@rurC)r`rMrNr�)r;rpZnumbytesr<r=r=r>r:szSystemRandom.getrandbitscCs
	t|�Sr9)r�rxr=r=r>r$BszSystemRandom.randbytescOs	dSr9r=�r;�args�kwdsr=r=r>r)HszSystemRandom.seedcOs
	td��)Nz*System entropy source does not have state.)�NotImplementedErrorr�r=r=r>�_notimplementedLszSystemRandom._notimplementedN)
r�r�r�r&rr$r)r�r r*r=r=r=r>r-src
s�ddlm}m}ddlm}|�}��fdd�td|�D�}|�}||�}	|||	�}
t|�}t|�}t||d�d|�d�j	���td	|	|
||f�dS)
Nr)�stdev�fmean)�perf_countercsg|]}����qSr=r=r��r��funcr=r>r�{sz#_test_generator.<locals>.<listcomp>z.3fz sec, z times z"avg %g, stddev %g, min %g, max %g
)
Z
statisticsr�r��timer�r��min�max�printr�)
ror�r�r�Zmeanr�Zt0�data�t1Zxbarr�r�r�r=r�r>�_test_generatorvs
 r���cCs�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td�t|td	�t|td
�t|td�t|td�t|td�t|td
�dS)Nr=)r�r3)g{�G�z�?r3)皙�����?r3)r�r1)r�r3)g�������?r3)r3r3)r1r3)g4@r3)gi@r3)�@r�)r�r3gUUUUUU�?)	r�r&r"r!r.rrrr,)�Nr=r=r>�_test�s r��fork)Zafter_in_child�__main__)r�)Z�warningsrrRZmathrr�rr�rr�rr�rr�rr�r	r�r
r�rr�rr�r
rrrr��osrr��_collections_abcrr�rr��operatorrry�	itertoolsrr�rr�rr��_osZ_randomrOr�ImportErrorZhashlib�__all__r�r�r�r�r�rzrrZ_instr)r&r-r,r%rr'r(r+rr"r!rr.rrrr#r/r r*rr$r�r��hasattr�register_at_forkr�r=r=r=r>�<module>s|/�
K,



�