AlkantarClanX12

Your IP : 3.15.211.71


Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/random.cpython-39.opt-2.pyc

a

R�f�z�@s�ddlmZddlmZmZmZ	m
ZmZ
ddlmZmZmZmZddlmZmZddlmZddlmZm Z!ddl"m#Z$m%Z&ddl'm'Z(dd	lZ)dd	l*Z*zdd
l+m,Z+Wne-y�dd
l.m,Z+Yn0gd�Z/ded
�ed�Z0ed�Z1ded�Z2dZ3de3Z4Gdd�de*j5�Z5Gdd�de5�Z6e5�Z7e7j8Z8e7j9Z9e7j:Z:e7j;Z;e7j<Z<e7j=Z=e7j>Z>e7j?Z?e7j@Z@e7jAZAe7jBZBe7jCZCe7jDZDe7jEZEe7jFZFe7jGZGe7jHZHe7jIZIe7jJZJe7jKZKe7jLZLe7jMZMe7jNZNdd�ZOd dd�ZPeQe)d��r�e)jRe7j8d�eSdk�r�eP�d	S)!�)�warn)�log�exp�pi�e�ceil)�sqrt�acos�cos�sin)�tau�floor)�urandom)�Set�Sequence)�
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&eZdZdZdAdd�ZdB�fdd�	Z�fdd	�Z�fd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zde
>fdd�ZeZdd�ZdCdd�Zdd�Zdd �ZdDd!d"�Zdd#�d$d%�ZdEddd&�d'd(�Zd)d*�ZdFd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Zd=d>�Z d?d@�Z!�Z"S)Gr�NcCs|�|�d|_dS�N)r'�
gauss_next)�self�x�r:�+/opt/alt/python39/lib64/python3.9/random.py�__init__us
zRandom.__init__r4cs|dkr�t|ttf�r�t|t�r*|�d�n|}|rBt|d�d>nd}tt|�D]}d||Ad@}qP|t|�N}|dkr~dn|}nj|d	kr�t|tttf�r�t|t�r�|��}t	�
|t|���d
�}n&t|t
d�t	ttttf�s�tdtd	�t��|�d|_dS)N�zlatin-1r�iCBl����������r4�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'r7)r8�a�versionr9�c��	__class__r:r;r'~s"
�zRandom.seedcs|jt���|jfSr6)�VERSIONrRrr7�r8rVr:r;r�szRandom.getstatec
s�|d}|dkr*|\}}|_t��|�nv|dkr�|\}}|_ztdd�|D��}Wn*ty~}zt|�WYd}~n
d}~00t��|�ntd||jf��dS)Nrr5r4css|]}|dVqdS)lNr:)�.0r9r:r:r;�	<genexpr>��z"Random.setstate.<locals>.<genexpr>z?state with version %s passed to Random.setstate() of version %s)r7rRr(�tuple�
ValueError�	TypeErrorrX)r8�staterTZ
internalstaterrVr:r;r(�s�zRandom.setstatecCs|��Sr6)rrYr:r:r;�__getstate__�szRandom.__getstate__cCs|�|�dSr6)r()r8r`r:r:r;�__setstate__�szRandom.__setstate__cCs|jd|��fS)Nr:)rWrrYr:r:r;�
__reduce__�szRandom.__reduce__cKsJ|jD]>}d|jvrqFd|jvr.|j|_qFd|jvr|j|_qFqdS)N�
_randbelowrr$)�__mro__�__dict__�_randbelow_with_getrandbitsrd�_randbelow_without_getrandbits)�cls�kwargsrUr:r:r;�__init_subclass__�s	



zRandom.__init_subclass__cCs4|sdS|j}|��}||�}||kr0||�}q|S)Nr)r�
bit_length)r8�nr�k�rr:r:r;rg�s
z"Random._randbelow_with_getrandbitsr=cCsj|j}||kr$td�t|�|�S|dkr0dS||}|||}|�}||krZ|�}qJt||�|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$rP�_floor)r8rm�maxsizer$Zrem�limitror:r:r;rh�sz%Random._randbelow_without_getrandbitscCs|�|d��|d�S)N��little)r�to_bytes�r8rmr:r:r;r"szRandom.randbytesc	Cst|�}||krtd��|dur:|dkr2|�|�Std��t|�}||krRtd��||}|dkrx|dkrx||�|�S|dkr�td|||f��t|�}||kr�td��|dkr�||d|}n"|dkr�||d|}ntd��|dkr�td��|||�|�S)	Nz!non-integer arg 1 for randrange()rzempty range for randrange()z non-integer stop for randrange()r=z(empty range for randrange() (%d, %d, %d)z non-integer step for randrange()zzero step for randrange())rKr^rd)	r8�start�stop�stepZistartZistop�widthZisteprmr:r:r;r%"s4

zRandom.randrangecCs|�||d�S)Nr=)r%�r8rS�br:r:r;r#NszRandom.randintcCs||�t|��Sr6)rdrH)r8�seqr:r:r;rWsz
Random.choicecCs�|durN|j}ttdt|���D]*}||d�}||||||<||<q nTtdtd�t}ttdt|���D]0}||�|d�}||||||<||<qpdS)Nr=zuThe *random* parameter to shuffle() has been deprecated
since Python 3.9 and will be removed in a subsequent version.r4)rd�reversed�rangerHrPrQrp)r8r9r$�	randbelow�i�jr
r:r:r;r)\s	�zRandom.shuffle)�countscs�t�t�rtdtd�t���t�t�s0td��t��}|dur�tt	|���t��|kr`t
d�����}t|t�sztd��|dkr�t
d��|j
t|�|d�}t����fd	d
�|D�S|j}d|kr�|ks�nt
d��dg|}d}	|d
k�r|	dtt|dd��7}	||	k�r\t��}
t|�D]2}|||�}|
|||<|
||d|
|<�q&nNt�}
|
j}t|�D]8}||�}||
v�r�||�}�q|||��|||<�qp|S)Nz\Sampling from a set deprecated
since Python 3.9 and will be removed in a subsequent version.r4zAPopulation 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)rncsg|]}���|��qSr:r:)rZ�s�rZ
cum_counts�
populationr:r;�
<listcomp>�r\z!Random.sample.<locals>.<listcomp>z,Sample larger than population or is negative��r.r5r=)rB�_SetrPrQr]�	_Sequencer_rH�list�_accumulater^�poprKr&r�_bisectrd�_ceil�_log�set�add)r8r�rnr�rm�totalZ
selectionsr��resultZsetsizeZpoolr�r�ZselectedZselected_addr:r�r;r&vsT5
�





z
Random.sample)�cum_weightsrncs�|j�t����dur�|durHt��d7�����fdd�td|�D�Sztt|���Wq�ty�t|t�sr�|}td|���d�Yq�0n|dur�td��t���kr�t	d���dd��dkr�t	d��t
��d	�������fd
d�td|�D�S)N�csg|]}�������qSr:r:�rZr�)r
rmr�r$r:r;r��r\z"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 populationr?z*Total of weights must be greater than zeror=cs$g|]}������d���qS)rr:r�)rr��hir�r$r�r:r;r��s�)r$rHrp�_repeatr�r�r_rBrKr^r�)r8r�Zweightsr�rnr:)rr�r
r�rmr�r$r�r;r�s<
��
�zRandom.choicescCs||||��Sr6�r$r{r:r:r;r+�szRandom.uniformr�r1cCsz|��}z |durdn||||}Wnty>|YS0||krbd|}d|}||}}|||t||�S)N��?r1)r$�ZeroDivisionError�_sqrt)r8�low�high�mode�urUr:r:r;r*s	 

zRandom.triangularcCsP|j}|�}d|�}t|d|}||d}|t|�krqDq|||S)Nr1r�r0)r$�
NV_MAGICCONSTr�)r8�mu�sigmar$�u1�u2�zZzzr:r:r;r s
zRandom.normalvariatecCs`|j}|j}d|_|durT|�t}tdtd|���}t|�|}t|�||_|||S)Ng�r1)r$r7�TWOPIr�r��_cos�_sin)r8r�r�r$r�Zx2piZg2radr:r:r;r,s
zRandom.gausscCst|�||��Sr6)�_expr )r8r�r�r:r:r;rRszRandom.lognormvariatecCstd|���|S�Nr1)r�r$)r8Zlambdr:r:r;r\szRandom.expovariatecCs�|j}|dkrt|�Sd|}|td||�}|�}tt|�}|||}|�}	|	d||ks�|	d|t|�kr4q�q4d|}
|
|d|
|}|�}|dkr�|t|�t}
n|t|�t}
|
S)Ng���ư>r�r1)r$r�r�r��_pir��_acos)r8r�Zkappar$r�ror�r��dr��q�fZu3Zthetar:r:r;r,ms$
$zRandom.vonmisesvariatecCs~|dks|dkrtd��|j}|dkr�td|d�}|t}||}|�}d|kr`dksdqFqFd|�}t|d|�|}	|t|	�}
|||}|||	|
}|td|dks�|t|�krF|
|SqFn�|dkr�td|��|S|�}
t|t}||
}|dk�r$|d|}
nt|||�}
|�}|dk�r^||
|dk�rp�qrq�|t|
�kr�qrq�|
|SdS)Nr�z*gammavariate: alpha and beta must be > 0.0r1r/gH�����z>g�P���?r2)r^r$r��LOG4r�r��
SG_MAGICCONST�_e)r8�alpha�betar$ZainvZbbbZcccr�r��vr9r�ror�r|�pr:r:r;r�s@
 

zRandom.gammavariatecCs(|�|d�}|r$|||�|d�SdS)Nr1r�)r)r8r�r��yr:r:r;r�szRandom.betavariatecCsd|��}d|d|Sr�r�)r8r�r�r:r:r;r!�szRandom.paretovariatecCs"d|��}|t|�d|Sr�)r$r�)r8r�r�r�r:r:r;r-�szRandom.weibullvariate)N)Nr4)Nr=)N)N)r�r1N)#�__name__�
__module__�__qualname__rXr<r'rr(rarbrcrkrg�BPFrhrdr"r%r#rr)r&rr+r*r rrrr,rrr!r-�
__classcell__r:r:rVr;res<
	*!

,	
c&
&
*Arc@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZeZZ	dS)rcCst�td�d�d?tS)Nr>rAr5)rKrL�_urandom�	RECIP_BPFrYr:r:r;r$szSystemRandom.randomcCs<|dkrtd��|dd}t�t|�d�}||d|?S)Nrz#number of bits must be non-negativer>rsrA)r^rKrLr�)r8rnZnumbytesr9r:r:r;rs
zSystemRandom.getrandbitscCst|�Sr6)r�rvr:r:r;r"szSystemRandom.randbytescOsdSr6r:�r8�args�kwdsr:r:r;r'%szSystemRandom.seedcOstd��dS)Nz*System entropy source does not have state.)�NotImplementedErrorr�r:r:r;�_notimplemented)szSystemRandom._notimplementedN)
r�r�r�r$rr"r'r�rr(r:r:r:r;r
s	rc
s�ddlm}m}ddlm}|�}��fdd�t|�D�}|�}||�}	|||	�}
t|�}t|�}t||d�d|�d�j	���td	|	|
||f�dS)
Nr)�stdev�fmean)�perf_countercsg|]}����qSr:r:r��r��funcr:r;r�Xr\z#_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�)
rmr�r�r�Zmeanr�Zt0�data�t1Zxbarr�r�r�r:r�r;�_test_generatorSs
 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�r1)g{�G�z�?r1)皙�����?r1)r�r/)r�r1)g�������?r1)r1r1)r/r1)g4@r1)gi@r1)�@r�)r�r1gUUUUUU�?)	r�r$r rr,rrrr*)�Nr:r:r;�_testds r��fork)Zafter_in_child�__main__)r�)T�warningsrrPZmathrr�rr�rr�rr�rr�rr�r	r�r
r�rr�rr�r
rp�osrr��_collections_abcrr�rr��	itertoolsrr�rr�rr��_osZ_randomrMr�ImportErrorZhashlib�__all__r�r�r�r�r�rr�_instr'r$r+r*r#rr%r&r)rr rrr,rrrr!r-rr(rr"r�r��hasattr�register_at_forkr�r:r:r:r;�<module>0sp
*,