AlkantarClanX12

Your IP : 18.188.113.189


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/random.cpython-312.opt-2.pyc

�

�Q�f{���\�	ddlmZddlmZmZmZ	m
ZmZ
ddlmZmZmZmZddlmZmZmZddlmZmZm Z!ddl"m#Z$ddl%m&Z'ddl(m)Z*dd	l+m,Z-m.Z/dd
l0m0Z1ddl"Z2ddl3Z3	ddl4m5Z6gd
�Z9ded�zed�zZ:ed�Z;ded�zZ<dZ=de=zZ>dZ?Gd�de3j��Z@Gd�de@�ZAe@�ZBeBj�ZCeBj�ZDeBj�ZEeBj�ZFeBj�ZGeBj�ZHeBj�ZIeBj�ZJeBj�ZKeBj�ZLeBj�ZMeBj�ZNeBj�ZOeBj�ZPeBj�ZQeBj�ZReBj�ZSeBj�ZTeBj�ZUeBj�ZVeBj�ZWeBj�ZXeBj�ZYeBj�ZZd�Z[d d�Z\e]e2d�re2j�eBj���e_dk(re\�yy#e7$r
ddl8m5Z6Y���wxYw)!�)�warn)�log�exp�pi�e�ceil)�sqrt�acos�cos�sin)�tau�floor�isfinite)�lgamma�fabs�log2)�urandom)�Sequence)�index)�
accumulate�repeat)�bisectN)�sha512)�Random�SystemRandom�betavariate�binomialvariate�choice�choices�expovariate�gammavariate�gauss�getrandbits�getstate�lognormvariate�
normalvariate�
paretovariate�	randbytes�randint�random�	randrange�sample�seed�setstate�shuffle�
triangular�uniform�vonmisesvariate�weibullvariate�g��@�@��?�@�5��c���eZdZ	dZd#d�Zd$�fd�	Z�fd�Z�fd�Zd�Zd�Z	d	�Z
d
�Zd�Zde
zfd
�ZeZd�Zdefd�Zd�Zd�Zd�Zdd�d�Zd#ddd�d�Zd�Zd%d�Zd&d�Zd&d�Zd�Zd'd�Zd�Zd�Zd�Z d �Z!d!�Z"d(d"�Z#�xZ$S))r�Nc�6�	|j|�d|_y�N)r-�
gauss_next)�self�xs  �-/opt/alt/python312/lib64/python3.12/random.py�__init__zRandom.__init__~s��	�
	
�	�	�!�����c	���	|dk(r�t|ttf�rpt|t�r|jd�n|}|rt	|d�dznd}tt|�D]
}d|z|zdz}�|t
|�z}|dk(rdn|}n�|d	k(rkt|tttf�rPt|t�r|j�}tj|t|�j�z�}n:t|td�tttttf�std
��t �|�E|�d|_y)Nr;zlatin-1r�iCBl����������r:zOThe only supported seed types are: None,
int, float, str, bytes, and bytearray.)�
isinstance�str�bytes�decode�ord�map�len�	bytearray�encode�int�
from_bytes�_sha512�digest�type�float�	TypeError�superr-r@)rA�a�versionrB�c�	__class__s     �rCr-zRandom.seed�s���	�"�a�<�J�q�3��,�7�'1�!�U�';�����#��A�"#��A�a�D�	�Q���A���a�[����k�Q�&�*<�<��!�
��Q��K�A��2�g��1�A�
��\�j��S�%��,C�D��!�S�!��H�H�J�����q�7�1�:�#4�#4�#6�6�7�A��A��T�
�C���U�I�N�O��E�F�
F�	���Q����rEc�P��	|jt�|�	�|jfSr?)�VERSIONrZr$r@)rAr^s �rCr$zRandom.getstate�s#���G��|�|�U�W�-�/����@�@rEc���	|d}|dk(r|\}}|_t�|�	|�y|dk(r.|\}}|_	td�|D��}t�|�	|�yt	d|�d|j����#t$r}t
|�d}~wwxYw)Nrr=r:c3�&K�|]	}|dz���y�w)lN�)�.0rBs  rC�	<genexpr>z"Random.setstate.<locals>.<genexpr>�s����%K�]��a�7�m�]�s�zstate with version z( passed to Random.setstate() of version )r@rZr.�tuple�
ValueErrorrYr`)rA�stater\�
internalstaterr^s     �rCr.zRandom.setstate�s����H���(���a�<�6;�3�G�]�D�O��G��]�+�
��\�6;�3�G�]�D�O�

'� %�%K�]�%K� K�
�
�G��]�+��%�t�|�|�5�6�
6��	�
'��Q�&��
'�s�A6�6	B�?B�Bc�"�|j�Sr?)r$�rAs rC�__getstate__zRandom.__getstate__�s���}�}��rEc�&�|j|�yr?)r.)rArhs  rC�__setstate__zRandom.__setstate__�s���
�
�e�rEc�<�|jd|j�fS)Nrc)r^r$rks rC�
__reduce__zRandom.__reduce__�s���~�~�r�4�=�=�?�2�2rEc���	|jD]T}d|jvryd|jvr|j|_yd|jvs�C|j|_yy)N�
_randbelowr#r*)�__mro__�__dict__�_randbelow_with_getrandbitsrr�_randbelow_without_getrandbits)�cls�kwargsr]s   rC�__init_subclass__zRandom.__init_subclass__�s^��	����A��q�z�z�)����
�
�*�!$�!@�!@�����1�:�:�%�!$�!C�!C����rEc�v�	|j}|j�}||�}||k\r||�}||k\r�|Sr?)r#�
bit_length)rA�nr#�k�rs     rCruz"Random._randbelow_with_getrandbits�sB��E��&�&��
�L�L�N����N���1�f��A��A��1�f��rEr;c���	|j}||k\rtd�t|�|z�S||z}||z
|z}|�}||k\r
|�}||k\r�
t||z�|zS)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*�_warn�_floor)rAr|�maxsizer*�rem�limitr~s       rCrvz%Random._randbelow_without_getrandbits�s���	�
������<��N�
O��&�(�Q�,�'�'���k���3��'�)���H���5�j���A��5�j��a�'�k�"�Q�&�&rEc�L�	|j|dz�j|d�S)N��little)r#�to_bytes�rAr|s  rCr(zRandom.randbytess'��&�����A��&�/�/��8�<�<rEc	���	t|�}|�4|turtd��|dkDr|j|�St	d��t|�}||z
}t|�}|dk(r+|dkDr||j|�zSt	d|�d|�d���|dkDr||zdz
|z}n|dkr||zdz|z}nt	d��|dkrt	d|�d|�d|�d���|||j|�zzS)	Nz Missing a non-None stop argumentrzempty range for randrange()r;zempty range in randrange(z, �)zzero step for randrange())�_index�_ONErYrrrg)	rA�start�stop�step�istart�istop�width�istepr|s	         rCr+zRandom.randrange#s,��	������<��4��� B�C�C���z����v�.�.��:�;�;��t��������t����A�:��q�y������ 6�6�6��8���r�$��q�I�J�J��1�9�����"�u�,�A�
�Q�Y�����"�u�,�A��8�9�9���6��8���r�$��r�$��q�Q�R�R������� 2�2�2�2rEc�.�	|j||dz�S�Nr;)r+�rAr[�bs   rCr)zRandom.randintLs��	��~�~�a��1��%�%rEc�j�	t|�std��||jt|��S)Nz$Cannot choose from an empty sequence)rP�
IndexErrorrr)rA�seqs  rCrz
Random.choiceUs2��@��3�x��C�D�D��4�?�?�3�s�8�,�-�-rEc��	|j}ttdt|���D]}||dz�}||||c||<||<� yr�)rr�reversed�rangerP)rArB�	randbelow�i�js     rCr/zRandom.shuffle^sQ��7��O�O�	��%��3�q�6�*�+�A��!�a�%� �A��1��q��t�J�A�a�D�!�A�$�,rE)�countsc��	t|t�std��t|�}|��t	t|��}t|�|k7rt
d��|j�}t|t�std��|dkrt
d��|jt|�|��}t}|D�	cgc]}	||||	���c}	S|j}
d|cxkr|kst
d��t
d��dg|z}d}|d	kDr|d
tt|dzd
��zz
}||kr>t	|�}
t|�D]#}|
||z
�}|
|||<|
||z
dz
|
|<�%|St�}|j }t|�D]+}|
|�}||vr
|
|�}||vr�
||�||||<�-|Scc}	w)
NzAPopulation 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)r}z,Sample larger than population or is negative��r4r=r;)rJ�	_SequencerYrP�list�_accumulaterg�poprSr,r��_bisectrr�_ceil�_log�set�add)rA�
populationr}r�r|�
cum_counts�total�
selectionsr�sr��result�setsize�poolr�r��selected�selected_adds                  rCr,z
Random.samplegs���	�h�*�i�0��@�A�
A��
�O�����k�&�1�2�J��:��!�#� �!U�V�V��N�N�$�E��e�S�)�� 9�:�:���z� �!L�M�M����U�5�\�Q��7�J��F�?I�J�z�!�J�v�j�!�4�5�z�J�J��O�O�	��A�{��{��K�L�L���K�L�L���!������q�5��q�E�$�q�1�u�a�.�1�1�1�G���<��
�#�D��1�X���a�!�e�$�� ��G��q�	��q�1�u�q�y�/��Q����
��u�H�#�<�<�L��1�X���a�L���8�m�!�!��A��8�m��Q��&�q�M��q�	���
��3Ks�8F;)�cum_weightsr}c
�^�	|j}t|�}|�N|�6t}|dz
}td|�D�cgc]}|||�|z���c}S	t	t|��}n
|�t
d��t|�|k7rtd��|ddz}	|	dkrtd��t|	�std��t}
|dz
}td|�D�cgc]}||
||�|	zd	|���c}Scc}w#t$r#t|t�s�|}t
d|���d�wxYwcc}w)
N�z4The number of choices must be a keyword argument: k=z2Cannot specify both weights and cumulative weightsz3The number of weights does not match the populationrHz*Total of weights must be greater than zerozTotal of weights must be finiter;r)r*rPr��_repeatr�r�rYrJrSrg�	_isfiniter�)rAr��weightsr�r}r*r|rr�r�r�his            rCrzRandom.choices�sk��	������
�O���������S���AH��q�AQ�R�AQ�A�
�5���A��#6�7�AQ�R�R�
�"�;�w�#7�8���
 ��P�Q�Q��{��q� ��R�S�S��B��#�%���C�<��I�J�J�����>�?�?���
��U�� ��q�)�+�)�A��6�+�v�x�%�/?��B�G�H�)�+�	+��+S���
�!�'�3�/�����K���M����	
��$+s�C6�C;�D*�;,D'c�6�	|||z
|j�zzSr?�r*r�s   rCr1zRandom.uniform�s#��	��A��E�T�[�[�]�*�*�*rEc��	|j�}	|�dn
||z
||z
z}||kDrd|z
}d|z
}||}}|||z
t||z�zzS#t$r|cYSwxYw)N��?r7)r*�ZeroDivisionError�_sqrt)rA�low�high�mode�ur]s      rCr0zRandom.triangular�s���	�
�K�K�M��	��|��$��*����)D�A�
�q�5��a��A��a��A��c��C��d�S�j�E�!�a�%�L�0�0�0��
!�	��J�	�s�A�A�Ac��	|j}	|�}d|�z
}t|dz
z|z}||zdz}|t|�krn�9|||zzS)Nr7r�r6)r*�
NV_MAGICCONSTr�)rA�mu�sigmar*�u1�u2�z�zzs        rCr&zRandom.normalvariatesl��	��������B��v�x��B���c��*�R�/�A��Q����B��d�2�h�Y���
��A��I�~�rEc���	|j}|j}d|_|�N|�tz}tdt	d|�z
�z�}t|�|z}t
|�|z|_|||zzS)Ng�r7)r*r@�TWOPIr�r��_cos�_sin)rAr�r�r*r��x2pi�g2rads       rCr"zRandom.gauss'sy��	�4�����O�O������9��8�e�#�D��$��c�F�H�n�!5�5�6�E��T�
�U�"�A�"�4�j�5�0�D�O��A��I�~�rEc�:�	t|j||��Sr?)�_expr&)rAr�r�s   rCr%zRandom.lognormvariateMs!��	��D�&�&�r�5�1�2�2rEc�D�	td|j�z
�|zS�Nr7)r�r*)rA�lambds  rCr zRandom.expovariateWs'��
	�"�S�4�;�;�=�(�)�)�E�1�1rEc��	|j}|dkrt|�zSd|z}|td||zz�z}	|�}tt|z�}|||zz}|�}	|	d||zz
ks|	d|z
t|�zkrn�Id|z}
|
|zd|
|zzz}|�}|dkDr|t
|�ztz}
|
S|t
|�z
tz}
|
S)Ng���ư>r�r7)r*r�r�r��_pir��_acos)rAr��kappar*r�r~r�r��dr��q�f�u3�thetas              rCr2zRandom.vonmisesvariateks���	������D�=��6�8�#�#��%�K��
��c�A��E�k�"�"�����B��S�2�X��A��Q��U��A���B��C�!�a�%�K��2�#��'�T�!�W�)<�#<���
�!�G��
��U�s�Q��U�{�#��
�X��
��8��%��(�]�e�+�E����%��(�]�e�+�E��rEc��	|dks|dkrtd��|j}|dkDr�td|zdz
�}|tz
}||z}	|�}d|cxkrdksn�d|�z
}t	|d|z
z�|z}	|t|	�z}
||z|z}|||	zz|
z
}|tzd|zz
dk\s|t	|�k\r|
|zS�z|dk(rt	d|�z
�|zS	|�}
t|ztz}||
z}|dkr	|d|zz}
nt	||z
|z�}
|�}|dkDr||
|dz
zkr	|
|zS|t|
�kr	|
|zS�o)Nr�z*gammavariate: alpha and beta must be > 0.0r7r5gH�����z>g�P���?r8)rgr*r��LOG4r�r��
SG_MAGICCONST�_e)rA�alpha�betar*�ainv�bbb�cccr�r��vrBr�r~r�r��ps                rCr!zRandom.gammavariate�s���	�&�C�<�4�3�;��I�J�J������3�;���u��s�*�+�D��$�,�C��$�,�C���X���b�,�9�,���6�8�^����s�R�x��)�D�0���D��G�O����G�b�L���#��'�M�A�%���}�$�s�Q�w�.�#�5��d�1�g���t�8�O���c�\���v�x��(�(�4�/�/�
��H���%�Z�2�%����E����8��c�E�k�*�A��q�1�u��o�.�.�A��X���s�7��Q�5�3�;�/�/���t�8�O��4���8�^���t�8�O�rEc�^�	|j|d�}|r|||j|d�zzSy)Nr7r�)r!)rAr�r��ys    rCrzRandom.betavariate�s>��
	�4
���e�S�)�����D�-�-�d�C�8�8�9�9�rEc�:�	d|j�z
}|d|zzS)Nr7g�r�)rAr�r�s   rCr'zRandom.paretovariate�s&��A�
�$�+�+�-����T�E�\�"�"rEc�T�	d|j�z
}|t|�d|zzzSr�)r*r�)rAr�r�r�s    rCr3zRandom.weibullvariates3��	�
�$�+�+�-�����a���c�D�j�1�1�1rEc���	|dkrtd��|dks|dk\r|dk(ry|dk(r|Std��|j}|dk(rt|�|k�S|dkDr||j|d|z
�z
S||zdkrFdx}}t	d|z
�}|s|S	|tt	|��|z�dzz
}||kDr|S|dz
}�/d
}t
||zd|z
z�}dd|zz}	d
d|	zzd|zz}
||zdz}dd|	zz
}	|�}|dz}dt|�z
}
td|
z|
z|	z|z|z�}|dks||kDr�@|�}|
dk\r||kr|S|sOdd|	zz|z}t|d|z
z�}t|dz|z�}t|dz�t||z
dz�z}d	}||
|
|
zz|	zzz}t|�t|dz�z
t||z
dz�z
|z
zzkr|S��)Nrzn must be non-negativer�r7z&p must be in the range 0.0 <= p <= 1.0r;r�g$@TFgffffff�?g=
ףp=@gE���JY��ga��+e�?�{�G�z�?gq=
ףp�?g������@r5g�Q���?g�p=
ף@gffffff@)
rgr*r�r�_log2r�r��_fabsr��_lgamma)rAr|r�r*rBr�r]�setup_complete�spqr�r[�vrr��usr}r�r��lpq�m�hs                    rCrzRandom.binomialvariates���	� 
�q�5��5�6�6���8�q�C�x��C�x���C�x����E�F�F�����
��6��&�(�Q�,�'�'�
�s�7��t�+�+�A�s�Q�w�7�7�7��q�5�4�<��I�A���c�A�g��A������V�E�&�(�O�a�/�0�1�4�4���q�5��H��Q���	����A��E�S�1�W�%�&���4�#�:����f�q�j� �4�!�8�+��
��E�C�K��
�C�!�G�^�����A�
��H�A��u�Q�x��B���a��"��q�(�A�-��1�2�A��1�u��A�����A��T�z�a�2�g���
"���a���3�.���1��a��=�)���A��E�Q�;�'���A��E�N�W�Q��U�Q�Y�%7�7��!%��
��!�r�B�w�-�!�+�,�,�A��A�w�!�g�a�!�e�n�,�w�q�1�u�q�y�/A�A�Q��U�c�M�Q�Q���5rEr?)Nr:)r�r7N�r�r7)r7)r;r�)%�__name__�
__module__�__qualname__r`rDr-r$r.rlrnrpryru�BPFrvrrr(r�r+r)rr/r,rr1r0r&r"r%r r2r!rr'r3r�
__classcell__)r^s@rCrrns������G��$�LA�6�B��3��(�9:�3��'�&-�J�=�%)�t�'3�R&�.�$�/3�]�~#+�t�q�#+�P	+�1�2�*$�L3�2�((�TC�J�@#�	2�VrErc�4�eZdZ	d�Zd�Zd�Zd�Zd�ZexZZ	y)rc�T�	tjtd��dz	tzS)NrGr=)rSrT�_urandom�	RECIP_BPFrks rCr*zSystemRandom.randomus"��E����x��{�+�q�0�I�=�=rEc��	|dkrtd��|dzdz}tjt|��}||dz|z
z	S)Nrz#number of bits must be non-negativerGr�)rgrSrTr	)rAr}�numbytesrBs    rCr#zSystemRandom.getrandbitsysL��H��q�5��B�C�C���E�a�<���N�N�8�H�-�.���X��\�A�%�&�&rEc��	t|�Sr?)r	r�s  rCr(zSystemRandom.randbytes�s��&���{�rEc��	yr?rc�rA�args�kwdss   rCr-zSystemRandom.seed�s��F�rEc��	td��)Nz*System entropy source does not have state.)�NotImplementedErrorrs   rC�_notimplementedzSystemRandom._notimplemented�s��K�!�"N�O�OrEN)
rrrr*r#r(r-rr$r.rcrErCrrls-���>�'���P�*�)�H�xrErc�6�ddlm}m}ddlm}|�}td|�D�cgc]}||���	}}|�}	||�}
|||
�}t
|�}t|�}
t|	|z
d�d|�d|j�|���td|
|||
fz�ycc}w)Nr)�stdev�fmean)�perf_counterz.3fz sec, z times z"avg %g, stddev %g, min %g, max %g
)
�
statisticsrr�timerr��min�max�printr)r|�funcrr�meanr�t0r��data�t1�xbarr�r�r�s              rC�_test_generatorr$�s���/�!�	��B�!(��q�!1�2�!1�A�D�$�K�!1�D�2�	��B���:�D��$���E�

�d�)�C��t�9�D�	�R�"�W�S�M���s�'�$�-�-����
A�B�	�
/�4���T�2J�
J�K��3s�Bc�h�t|td�t|td�t|td�t|td�t|t
d�t|t
d�t|td�t|td�t|td�t|td�t|td	�t|td
�t|td�t|td�t|td
�t|td�t|td�t|td�y)Nrcr)�g333333�?)�dg�?)r�r7)皙�����?r7)r(r5)r�r7)g�������?r7)r7r7)r5r7)g4@r7)gi@r7)�@r))r�r7gUUUUUU�?)
r$r*r&r%r2rr!r"rr0)�Ns rC�_testr+�s����A�v�r�"��A�}�j�1��A�~�z�2��A��
�3��A��
�3��A���4��A�|�[�1��A�|�Z�0��A�|�Z�0��A�|�Z�0��A�|�Z�0��A�|�Z�0��A�|�Z�0��A�|�[�1��A�|�\�2��A�u�j�)��A�{�J�/��A�z�#8�9rE�fork)�after_in_child�__main__)i')`�warningsrr��mathrr�rr�rr�rr�rr�r	r�r
r�rr�rr�r
r�rr�rr�rr�rr�rr��osrr	�_collections_abcrr��operatorrr��	itertoolsrr�rr�rr��_os�_random�_sha2rrU�ImportError�hashlib�__all__r�r�r�rr
r�rr�_instr-r*r1r0r)rr+r,r/rr&r%r r2r!r"rrr'r3r$r.r#r(r$r+�hasattr�register_at_forkrrcrErC�<module>r>s���.�h#�L�L�G�G�E�E�@�@�"�2�$�B�$���*�'�
��:�D��J���s��+�
��C�y���d�3�i��
���
�#��I�	���w�W�^�^�w�|"*�6�"*�X	����z�z��	����
�-�-��
�
�
�
�
�-�-��	�����O�O�	�	����
�-�-��
�-�-���#�#�
��%�%�������'�'���!�!��
���������'�'���#�#�
��%�%���>�>���>�>�������O�O�	�L�":�0�3����C����
�
�3��z��	�G���}�*�)�)�*�s�H�H+�*H+