Şuanki Dizin: /usr/lib64/python3.9/__pycache__/ |
Şuanki Dosya : //usr/lib64/python3.9/__pycache__/random.cpython-39.opt-2.pyc |
a �DOg�z�@s�ddlmZddlmZmZmZ m ZmZ 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/ded �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�Zdd �Zdd�Z dd�Z dd�Zdd�Zde >fdd�ZeZdd�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:�/usr/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�_sha512�digest�type�float�_warn�DeprecationWarning�superr'r7)r8�a�versionr9�c�� __class__r:r;r'~s" �zRandom.seedcs|jt���|jfSr6)�VERSIONrSrr7�r8rWr: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)r7rSr(�tuple� ValueError� TypeErrorrY)r8�staterU� internalstaterrWr:r;r(�s�zRandom.setstatecCs|��Sr6)rrZr:r:r;�__getstate__�szRandom.__getstate__cCs|�|�dSr6)r()r8rar:r:r;�__setstate__�szRandom.__setstate__cCs|jd|��fS)Nr:)rXrrZr:r:r;� __reduce__�szRandom.__reduce__cKsJ|jD]>}d|jvrqFd|jvr.|j|_qFd|jvr|j|_qFqdS)N� _randbelowrr$)�__mro__�__dict__�_randbelow_with_getrandbitsrf�_randbelow_without_getrandbits)�cls�kwargsrVr:r:r;�__init_subclass__�s zRandom.__init_subclass__cCs4|sdS|j}|��}||�}||kr0||�}q|S)Nr)r� bit_length)r8�nr�k�rr:r:r;ri�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$rQ�_floor)r8ro�maxsizer$�rem�limitrqr:r:r;rj�sz%Random._randbelow_without_getrandbitscCs|�|d��|d�S)N��little)r�to_bytes�r8ror: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_rf) r8�start�stop�step�istart�istop�width�istepror:r:r;r%"s4 zRandom.randrangecCs|�||d�S)Nr=)r%�r8rT�br:r:r;r#NszRandom.randintcCs||�t|��Sr6)rfrH)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)rf�reversed�rangerHrQrRrr)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)rpcsg|]}���|��qSr:r:)r[�s�r� cum_counts� populationr:r;� <listcomp>�r]z!Random.sample.<locals>.<listcomp>z,Sample larger than population or is negative��r.r5r=)rB�_SetrQrRr^� _Sequencer`rH�list�_accumulater_�poprKr&r��_bisectrf�_ceil�_log�set�add)r8r�rpr�ro�total� selectionsr��result�setsize�poolr�r��selected�selected_addr:r�r;r&vsT5 � z Random.sample)�cum_weightsrpcs�|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:�r[r�)r ror�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$rHrr�_repeatr�r�r`rBrKr_r�)r8r��weightsr�rpr:)rr�r r�ror�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�urVr:r:r;r*s zRandom.triangularcCsP|j}|�}d|�}t|d|}||d}|t|�krqDq|||S)Nr1r�r0)r$� NV_MAGICCONSTr�)r8�mu�sigmar$�u1�u2�z�zzr: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��x2pi�g2radr:r:r;r,s zRandom.gausscCst|�||��Sr6)�_expr )r8r�r�r:r:r;rRszRandom.lognormvariatecCstd|���|S�Nr1)r�r$)r8�lambdr: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��kappar$r�rqr�r��dr��q�f�u3�thetar: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$�ainv�bbb�cccr�r��vr9r�rqr�r��pr:r:r;r�s@ zRandom.gammavariatecCs(|�|d�}|r$|||�|d�SdS)Nr1r�)r)r8r�r��yr:r:r;r�szRandom.betavariatecCsd|��}d|d|Sr�r�)r8r�r�r:r:r;r!�szRandom.paretovariatecCs"d|��}|t|�d|Sr�)r$r�)r8r�r�r�r:r:r;r-�szRandom.weibullvariate)N)Nr4)Nr=)N)N)r�r1N)#�__name__� __module__�__qualname__rYr<r'rr(rcrdrermri�BPFrjrfr"r%r#rr)r&rr+r*r rrrr,rrr!r-� __classcell__r:r:rWr;res< *! , c& & *Arc@s<eZdZdd�Zdd�Zdd�Zdd�Zd d �ZeZZ dS)rcCst�td�d�d?tS)Nr>rAr5)rKrL�_urandom� RECIP_BPFrZr:r:r;r$szSystemRandom.randomcCs<|dkrtd��|dd}t�t|�d�}||d|?S)Nrz#number of bits must be non-negativer>rvrA)r_rKrLr�)r8rp�numbytesr9r:r:r;rs zSystemRandom.getrandbitscCst|�Sr6)r�ryr:r:r;r"szSystemRandom.randbytescOsdSr6r:�r8�args�kwdsr:r:r;r'%szSystemRandom.seedcOstd��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 ) � statisticsr�r��timer�r��min�max�printr�) ror�r�r��meanr��t0�data�t1�xbarr�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)�after_in_child�__main__)r�)T�warningsrrQ�mathrr�rr�rr�rr�rr�rr�r r�r r�rr�rr�r rr�osrr��_collections_abcrr�rr�� itertoolsrr�rr�rr��_os�_randomrMr�ImportError�hashlib�__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 *,
Linux 65-254-81-4.cprapid.com 5.14.0-284.11.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 9 05:49:00 EDT 2023 x86_64
Apache
65.254.81.4