Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
random.cpython-314.pyc380 linesDownload Raw Back to __pycache__
1+
2��i�����Rt^RIHtHtHtHt	H3t^RIHt
HtHtHt^RIHtHtHt^RIHtHtHt^RI H!t"^RI#H$t%^RI&H't(^RI)H*t+H,t-^R	I.H.t/^R4I t0^R5I1t1.ROt2^]!R4,]
!R
4,t3]!R4t4R]!R4,t5^5t6^]6),t7^t8R6s9!RR]1Pt4t:!RR]:4t;]:!4t<]<Pzt=]<P|t>]<P~t?]<P�t@]<P�tA]<P�tB]<P�tC]<P�tD]<P�tE]<P�tF]<P�tG]<P�tH]<P�tI]<P�tJ]<P�tK]<P�tL]<P�tM]<P�tN]<P�tO]<P�tP]<P�tQ]<P�tR]<P�tS]<P�tTRtURRltV]W!]0R4'd]0P�!]<PzR7RRltYRRRlltZ][R8Xd]\!]Z!44R7#R8#) aERandom variable generators.9 10    bytes11    -----12           uniform bytes (values between 0 and 255)13 14    integers15    --------16           uniform within range17 18    sequences19    ---------20           pick random element21           pick random sample22           pick weighted random sample23           generate random permutation24 25    distributions on the real line:26    ------------------------------27           uniform28           triangular29           normal (Gaussian)30           lognormal31           negative exponential32           gamma33           beta34           pareto35           Weibull36 37    distributions on the circle (angles 0 to 2pi)38    ---------------------------------------------39           circular uniform40           von Mises41 42    discrete distributions43    ----------------------44           binomial45 46 47General notes on the underlying Mersenne Twister core generator:48 49* The period is 2**19937-1.50* It is one of the most extensively tested generators in existence.51* The random() method is implemented in C, executes in a single Python step,52  and is, therefore, threadsafe.53 54)�log�exp�pi�e�ceil)�sqrt�acos�cos�sin)�tau�floor�isfinite)�lgamma�fabs�log2)�urandom)�Sequence)�index)�55accumulate�repeat)�bisectN�Random�SystemRandom�@�@��?�@c�Baa�]tRt^gtoRt^tR$RltR%V3RlltV3RltV3Rlt	Rt56RtR	tR57t
Rt^],3Rlt]tR
tR]3RltRtRtRtRR/RltR$RRR^/RlltRtR&RltR'RltR'RltRtR(RltRt Rt!Rt"R t#R!t$R)R"lt%R#t&Vt'V;t(#)*ra�Random number generator base class used by bound module functions.58 59Used to instantiate instances of Random to get generators that don't60share state.61 62Class Random can also be subclassed if you want to use a different basic63generator of your own devising: in that case, override the following64methods:  random(), seed(), getstate(), and setstate().65Optionally, implement a getrandbits() method so that randrange()66can cover arbitrarily large ranges.67 68Nc�6�VPV4RVnR#)zUInitialize an instance.69 70Optional argument x controls seeding, as for Random.seed().71N)�seed�72gauss_next)�self�xs&&�
Lib\random.py�__init__�Random.__init__ws��	
�	�	�!�����c	�z<�V^8Xd�\V\\34'd�\V\4'dVPR4MTpV'd\	V^,4^,M^p\\V4FpRV,V,R,pK	V\
V4,pVR8XdRMTpM�V^8Xd�\V\\\34'dj\f^RI	H73s\V\4'dVP4p\PV\V4P!4,4pM@\V\#R4\\$\\\34'g\'R4h\(SV`UV4RVnR# \d74^RIH75sL�i;i)	aInitialize internal state from a seed.76 77The only supported seed types are None, int, float,78str, bytes, and bytearray.79 80None or no argument seeds from current time or from an operating81system specific randomness source if available.82 83If *a* is an int, all bits are used.84 85For version 2 (the default), all of the bits are used if *a* is a str,86bytes, or bytearray.  For version 1 (provided for reproducing random87sequences from older versions of Python), the algorithm for str and88bytes generates a narrower range of seeds.89 90zlatin-1iCBl����N)�sha512zOThe only supported seed types are:91None, int, float, str, bytes, and bytearray.����������)�92isinstance�str�bytes�decode�ord�map�len�	bytearray�_sha512�_sha2r(�ImportError�hashlib�encode�int�93from_bytes�digest�type�float�	TypeError�superrr )r!�a�versionr"�c�	__class__s&&&  �r#r�Random.seed�sI���$�a�<�J�q�3��,�7�7�'1�!�U�';�';�����#��A�"#��A�a�D�	�Q���A���a�[����k�Q�&�*<�<��!�
��Q��K�A��2�g��1�A�
��\�j��S�%��,C�D�D���:�8�94�!�S�!�!��H�H�J�����q�7�1�:�#4�#4�#6�6�7�A��A��T�95�C���U�I�N�O�O��K�L�
L�	���Q������#�:�9�:�s�.F&�&F:�9F:c�N<�VP\SV`	4VP3#)z9Return internal state; can be passed to setstate() later.)�VERSIONr>�getstater )r!rBs&�r#rF�Random.getstate�s ����|�|�U�W�-�/����@�@r&c�f<�V^,pV^8XdVwr#Vn\SV`	V4R#V^8XdIVwr#Vn\;QJd.RV4FNK	5M
!RV44p\ST`	T4R#\	RV:RVP:24h \d
p\96ThRp?ii;i)z:Restore internal state from object returned by getstate().c3�2"�TF
qR,x�K	R#5i)�Nl�)�.0r"s& r#�	<genexpr>�"Random.setstate.<locals>.<genexpr>�s���%K�]��7�m�m�]�s�Nzstate with version z( passed to Random.setstate() of version )r r>�setstate�tuple�97ValueErrorr=rE)r!�stater@�
internalstaterrBs&&   �r#rO�Random.setstate�s������(���a�<�6;�3�G�D�O��G��]�+�
��\�6;�3�G�D�O�98
'� %��%K�]�%K���%K�]�%K� K�
�
�G��]�+��%�t�|�|�5�6�
6��	�
'��Q�&��
'�s�,B�B0�$B+�+B0c�"�VP4#�N)rF�r!s&r#�__getstate__�Random.__getstate__�s���}�}��r&c�(�VPV4R#rV)rO)r!rRs&&r#�__setstate__�Random.__setstate__�s���
�
�e�r&c�<�VPRVP43#)NrK)rBrFrWs&r#�99__reduce__�Random.__reduce__�s���~�~�r�4�=�=�?�2�2r&c���VPFapRVP9dR#RVP9dVPVnR#RVP9gKOVPVnR#	R#)z�Control how subclasses generate random integers.100 101The algorithm a subclass can use depends on the random() and/or102getrandbits() implementation available to it and determines103whether it can generate random integers from arbitrarily large104ranges.105�106_randbelow�getrandbits�randomN)�__mro__�__dict__�_randbelow_with_getrandbitsra�_randbelow_without_getrandbits)�cls�kwargsrAs", r#�__init_subclass__�Random.__init_subclass__�sY�����A��q�z�z�)����107�108�*�!$�!@�!@�����1�:�:�%�!$�!C�!C����r&c�z�VP4pVPV4pW18�dVPV4pKV#)z;Return a random int in the range [0,n).  Defined for n > 0.)�109bit_lengthrb)r!�n�k�rs&&  r#rf�"Random._randbelow_with_getrandbits�s9��
�L�L�N�����Q����f�� � ��#�A��r&c���VPpW8�d&^RIHpV!R4\V!4V,4#W!,pW%,110V,pV!4pWv8�d111V!4pK\Wr,4V,#)z{Return a random int in the range [0,n).  Defined for n > 0.112 113The implementation does not use getrandbits, but only random.114)�warnz�Underlying random() generator does not supply 115enough bits to choose from a population range this large.116To remove the range limitation, add a getrandbits() method.)rc�warningsrs�_floor)r!rn�maxsizercrs�rem�limitrps&&&     r#rg�%Random._randbelow_without_getrandbits�so�������<�%��O�
P��&�(�Q�,�'�'��k����'�)���H���j���A��a�k�"�Q�&�&r&c�R�VPV^,4PVR4#)�Generate n random bytes.�little)rb�to_bytes�r!rns&&r#�	randbytes�Random.randbytess$������A��&�/�/��8�<�<r&c	�<�\V4pVf9V\Jd\R4hV^8�dVPV4#\	R4h\V4pWT,117p\V4pV^8Xd1V^8�dW@PV4,#\	RVRVR24hV^8�dWg,^,118V,pM)V^8dWg,^,V,pM\	R4hV^8:d\	RVRVRVR24hWGVPV4,,#)z�Choose a random item from range(stop) or range(start, stop[, step]).119 120Roughly equivalent to ``choice(range(start, stop, step))`` but121supports arbitrarily large ranges and is optimized for common cases.122 123z Missing a non-None stop argumentzempty range for randrange()zempty range in randrange(�, �)zzero step for randrange())�_index�_ONEr=rarQ)	r!�start�stop�step�istart�istop�width�isteprns	&&&&     r#�	randrange�Random.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�2r&c��\V4p\V4pW!8d\RVRVR24hWPW!,124^,4,#)zJReturn random integer in range [a, b], including both end points.125        zempty range in randint(r�r�)r�rQra�r!r?�bs&&&r#�randint�Random.randintOsN��
�1�I���1�I���5��6�q�c��A�3�a�@�A�A��?�?�1�5�1�9�-�-�-r&c�z�\V4'g\R4hWP\V44,#)z2Choose a random element from a non-empty sequence.z$Cannot choose from an empty sequence)r1�126IndexErrorra)r!�seqs&&r#�choice�
Random.choice[s/��127�3�x�x��C�D�D��?�?�3�s�8�,�-�-r&c��VPp\\^\V444F'pV!V^,4pW,W,uW&W&K)	R#)z)Shuffle list x in place, and return None.N)ra�reversed�ranger1)r!r"�	randbelow�i�js&&   r#�shuffle�Random.shuffledsH���O�O�	��%��3�q�6�*�+�A��!�a�%� �A���q�t�J�A�D�!�$�,r&�countsc��\V\4'g\R4h\V4pVe�\	\V44p\V4V8wd\
R4hV'dVP4M^p\V\4'g\R4hV^8d\
R4hVP\V4VR7p\pVU	u.uFq�V!WY4,NK	up	#VPp128^Tu;8:dV8:gM\
R4hR.V,p^pV^8�d+V^\\V^,^44,,
pWL8:dP\	V4p
\V4F3pV129!WN,1304pW�,W�&W�V,131^,132,W�&K5	V#\4pVP p\V4F.pV133!V4pVV9dV134!V4pKV!V4W,W�&K0	V#uup	i)a�Chooses k unique random elements from a population sequence.135 136Returns a new list containing elements from the population while137leaving the original population unchanged.  The resulting list is138in selection order so that all sub-slices will also be valid random139samples.  This allows raffle winners (the sample) to be partitioned140into grand prize and second place winners (the subslices).141 142Members of the population need not be hashable or unique.  If the143population contains repeats, then each occurrence is a possible144selection in the sample.145 146Repeated elements can be specified one at a time or with the optional147counts parameter.  For example:148 149    sample(['red', 'blue'], counts=[4, 2], k=5)150 151is equivalent to:152 153    sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5)154 155To choose a sample from a range of integers, use range() for the156population argument.  This is especially fast and space efficient157for sampling from a large population:158 159    sample(range(10000000), 60)160 161zAPopulation must be a sequence.  For dicts or sets, use sorted(d).Nz2The number of counts does not match the populationzCounts must be integerszCounts must be non-negative)roz,Sample larger than population or is negative)r+�	_Sequencer=r1�list�_accumulaterQ�popr8�sampler��_bisectra�_ceil�_log�set�add)r!�162populationror�rn�163cum_counts�total�164selectionsr�sr��result�setsize�poolr�r��selected�selected_adds&&&$              r#r��
Random.samplems���j�*�i�0�0��@�A�
A��165�O�����k�&�1�2�J��:��!�#� �!U�V�V�(2�J�N�N�$��E��e�S�)�)�� 9�:�:��q�y� �!>�?�?����U�5�\�Q��7�J��F�?I�J�z�!�v�j�4�5�5�z�J�J��O�O�	��A�{��{��K�L�L���!������q�5��q�E�$�q�1�u�a�.�1�1�1�G��<��166�#�D��1�X���a�e�$�� �G��	��1�u�q�y�/�����
��u�H�#�<�<�L��1�X���a�L���8�m�!�!��A��Q��&�M��	���
��3Ks�G<�cum_weightsroc167���VPp\V4pVf^VfD\pVR,
p\RV4Uu.uFq�V!V!4V,4,NK	up#\	\V44pMVe\
R4h\V4V8wd\R4hVR,R,p	V	R8:d\R4h\V	4'g\R4h\p168V^,169p\RV4Uu.uFpW!W5!4V	,^V4,NK!	up#uupi \d+\T\4'ghTp\
RT:24Rhi;iuupi)	z�Return a k sized list of population elements chosen with replacement.170 171If the relative weights or cumulative weights are not specified,172the selections are made with equal probability.173 174N�z4The number of choices must be a keyword argument: k=z2Cannot specify both weights and cumulative weightsz3The number of weights does not match the populationz*Total of weights must be greater than zerozTotal of weights must be finiter))rcr1ru�_repeatr�r�r=r+r8rQ�	_isfiniter�)r!r��weightsr�rorcrnrr�r�r�his&&&$$       r#�choices�Random.choices�sp�������175�O���������S���AH��q�AQ�R�AQ�A�5���A��#6�7�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�H�)�+�	+��+S���
�!�'�3�/�/�����K���M����	
��$+s�#D&�$D+�>%E#�+5E c�J�WV,176VP4,,#)z�Get a random number in the range [a, b) or [a, b] depending on rounding.177 178The mean (expected value) and variance of the random variable are:179 180    E[X] = (a + b) / 2181    Var[X] = (b - a) ** 2 / 12182 183�rcr�s&&&r#�uniform�Random.uniform�s����E�T�[�[�]�*�*�*r&c���VP4pVfRMW1,184W!,185,pYE8�dRT,186pRT,187pY!r!YT,188\YE,4,,# \dTu#i;i)auTriangular distribution.189 190Continuous distribution bounded by given lower and upper limits,191and having a given mode value in-between.192 193http://en.wikipedia.org/wiki/Triangular_distribution194 195The mean (expected value) and variance of the random variable are:196 197    E[X] = (low + high + mode) / 3198    Var[X] = (low**2 + high**2 + mode**2 - low*high - low*mode - high*mode) / 18199 200��?r)rc�ZeroDivisionError�_sqrt)r!�low�high�mode�urAs&&&&  r#�201triangular�Random.triangular�st��
�K�K�M��	��|��$�*���)D�A�
�5��a��A��a��A����S�j�E�!�%�L�0�0�0��
!�	��J�	�s�A,�,
A<�;A<c���VPpV!4pRV!4,202p\VR,203,V,pWf,R,pV\V4)8:gKSYT,,#)zLNormal distribution.204 205mu is the mean, and sigma is the standard deviation.206 207rr�r)rc�
NV_MAGICCONSTr�)r!�mu�sigmarc�u1�u2�z�zzs&&&     r#�
normalvariate�Random.normalvariates\���������B��v�x��B���c��*�R�/�A�����B��d�2�h�Y�����I�~�r&c�*�VPpVPpRVnVfcV!4\,p\R\	RV!4,2084,4p\V4V,p\
V4V,VnWV,,#)z�Gaussian distribution.209 210mu is the mean, and sigma is the standard deviation.  This is211slightly faster than the normalvariate() function.212 213Not thread-safe without a lock around calls.214 215Nrg�)rcr �TWOPIr�r��_cos�_sin)r!r�r�rcr��x2pi�g2rads&&&    r#�gauss�Random.gauss-sr��6�����O�O������9��8�e�#�D��$��c�F�H�n�!5�5�6�E��T�216�U�"�A�"�4�j�5�0�D�O���I�~�r&c�6�\VPW44#)z�Log normal distribution.217 218If you take the natural logarithm of this distribution, you'll get a219normal distribution with mean mu and standard deviation sigma.220mu can have any value, and sigma must be greater than zero.221 222)�_expr�)r!r�r�s&&&r#�lognormvariate�Random.lognormvariateSs���D�&�&�r�1�2�2r&c�R�\RVP4,2234)V,#)a�Exponential distribution.224 225lambd is 1.0 divided by the desired mean.  It should be226nonzero.  (The parameter would be called "lambda", but that is227a reserved word in Python.)  Returned values range from 0 to228positive infinity if lambd is positive, and from negative229infinity to 0 if lambd is negative.230 231The mean (expected value) and variance of the random variable are:232 233    E[X] = 1 / lambd234    Var[X] = 1 / lambd ** 2235 236r)r�rc)r!�lambds&&r#�expovariate�Random.expovariate]s"��$�S�4�;�;�=�(�)�)�E�1�1r&c�P�VPpVR8:d\V!4,#RV,pV\RWD,,4,pV!4p\\V,4pWuV,,pV!4p	V	RW�,,2378g!V	RV,238\V4,8:gKhRT,p239Y�,RY�,,,pT!4pTR8�d T\
T4,\,p
T
#T\
T4,240\,p
T
#)aCircular data distribution.241 242mu is the mean angle, expressed in radians between 0 and 2*pi, and243kappa is the concentration parameter, which must be greater than or244equal to zero.  If kappa is equal to zero, this distribution reduces245to a uniform random angle over the range 0 to 2*pi.246 247g�����ư>r�r)rcr�r�r��_pir��_acos)r!r��kapparcr�rpr�r��dr��q�f�u3�thetas&&&           r#�vonmisesvariate�Random.vonmisesvariateqs��� �����D�=��6�8�#�#��%�K��
��c�A�E�k�"�"�����B��S�2�X��A���U��A���B��C�!�%�K��2�#��'�T�!�W�)<�#<���!�G��
�U�s�Q�U�{�#��
�X��
��8��%��(�]�e�+�E����%��(�]�e�+�E��r&c��VR8:gVR8:d\R4hVPpVR8�d�\RV,R,2484pV\,249pW,pV!4pRTu;8dR8gMKRV!4,250p\	VRV,251,4V,p	V\V	4,p252Ww,V,pWVV	,,V253,254pV\,RV,,255R8�gV\	V48�gK�W�,#VR8Xd \	RV!4,2564)V,#V!4p
\V,\,pW�,pVR8:dVRV,,p257M\	W�,258V,4)p259V!4pVR8�d WzVR,260,8:d261W�,#K�V\V262)48:gK�W�,#)a�Gamma distribution.  Not the gamma function!263 264Conditions on the parameters are alpha > 0 and beta > 0.265 266The probability distribution function is:267 268            x ** (alpha - 1) * math.exp(-x / beta)269  pdf(x) =  --------------------------------------270              math.gamma(alpha) * beta ** alpha271 272The mean (expected value) and variance of the random variable are:273 274    E[X] = alpha * beta275    Var[X] = alpha * beta ** 2276 277r�z*gammavariate: alpha and beta must be > 0.0rrgH�����z>g�P����?r)rQrcr��LOG4r�r��
SG_MAGICCONST�_e)r!�alpha�betarc�ainv�bbb�cccr�r��vr"r�rpr�r��ps&&&             r#�gammavariate�Random.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���8�O�
�c�\���v�x��(�(�4�/�/�278��H���%�Z�2�%���E����8��c�E�k�*�A��q�u��o�.�.�A��X���s�7��5�3�;�/�/���8�O�	0��4���8�^���8�Or&c�x�VPVR4pV'd W3VPVR4,,#R#)a!Beta distribution.279 280Conditions on the parameters are alpha > 0 and beta > 0.281Returned values range between 0 and 1.282 283The mean (expected value) and variance of the random variable are:284 285    E[X] = alpha / (alpha + beta)286    Var[X] = alpha * beta / ((alpha + beta)**2 * (alpha + beta + 1))287 288rr�)r�)r!r�r��ys&&& r#�betavariate�Random.betavariate�s7��6
���e�S�)����D�-�-�d�C�8�8�9�9�r&c�P�RVP4,289pVRV,,#)z3Pareto distribution.  alpha is the shape parameter.rg�r�)r!r�r�s&& r#�
paretovariate�Random.paretovariates#��
�$�+�+�-����T�E�\�"�"r&c�r�RVP4,290pV\V4)RV,,,#)zVWeibull distribution.291 292alpha is the scale parameter and beta is the shape parameter.293 294r)rcr�)r!r�r�r�s&&& r#�weibullvariate�Random.weibullvariates.��
�$�+�+�-�����a���c�D�j�1�1�1r&c���V^8d\R4hVR8:gVR8�dVR8Xd^#VR8XdV#\R4hVPpV^8Xd\V!4V84#VR8�d WPVRV,2954,296#W,R8db^;rE\	RV,2974pV'gV#V\\	V!44V,4^,,
pWQ8�dV#V^,
pKBW,R8�dVR8:gQhRp\
W,RV,298,4pR	R299V,,p	RRV	,,RV,,p300W,R,pR
RV	,,301pV!4pVR,pR\V4,302p
\RV303,V
,V	,V,V,4pV^8gW�8�dK`V!4pV
R8�d	W�8:dV#V'g|RRV	,,V,p\VRV,304,4p\V^,V,4p\V^,4\VV,305^,4,pRpVXW�V
,,V	,,,p\V4X\V^,4,306\W,307^,4,308VX,309X,,8:gEKyV#)a�Binomial random variable.310 311Gives the number of successes for *n* independent trials312with the probability of success in each trial being *p*:313 314    sum(random() < p for i in range(n))315 316Returns an integer in the range:317 318    0 <= X <= n319 320The integer is chosen with the probability:321 322    P(X == k) = math.comb(n, k) * p ** k * (1 - p) ** (n - k)323 324The mean (expected value) and variance of the random variable are:325 326    E[X] = n * p327    Var[X] = n * p * (1 - p)328 329zn must be non-negativer�rz&p must be in the range 0.0 <= p <= 1.0r�g$@TFgffffff�?g=330ףp=@ga��+e�?�{�G�z�?gq=331ףp�?g������@rg�Q���?g�p=332ף@gffffff@gE���JY��)333rQrcr��binomialvariate�_log2rur��_fabsr��_lgamma)r!rnr�rcr"rrA�setup_complete�spqr�r?�vrr��usror�r��lpq�m�hs&&&                 r#r
�Random.binomialvariatesr��.
�q�5��5�6�6���8�q�C�x��C�x���C�x����E�F�F�����
��6��&�(�Q�,�'�'�
�s�7��+�+�A�s�Q�w�7�7�7��5�4�<��I�A��c�A�g��A������V�E�&�(�O�a�/�0�1�4�4���5��H��Q����s�d�{�q�C�x�'�'����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��T�z�a�g���334"���a���3�.���1��a��=�)���A��E�Q�;�'���A��E�N�W�Q��U�Q�Y�%7�7��!%��
��!�B�w�-�!�+�,�,�A��A�w�!�g�a�!�e�n�,�w�q�u�q�y�/A�A�Q��U�c�M�Q�Q��r&)r rV)NrJ)r�rN�r�r)r)�r�))�__name__�335__module__�__qualname__�__firstlineno__�__doc__rEr$rrFrOrXr[r^rjrf�BPFrgrarr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr	r
�__static_attributes__�__classdictcell__�
__classcell__)rB�
__classdict__s@@r#rrgs�������G��.�`A�6�B��3��(�9:�3��'�(-�J�=�%)�t�'3�R.�.�$�]�d�]�~#+�t�#+�q�#+�P	+�1�2�*$�L3�2�((�TC�J�@#�	2�\�\r&c�Ja�]tRtRtoRtRtRtRtRtRt	]	;t336tRtVt
R	#)337rixz�Alternate random number generator using sources provided338by the operating system (such as /dev/urandom on Unix or339CryptGenRandom on Windows).340 341 Not available on all systems (see os.urandom() for details).342 343c�b�\P\^44^,	\,#)z7Get the next random number in the range 0.0 <= X < 1.0.)r8r9�_urandom�	RECIP_BPFrWs&r#rc�SystemRandom.random�s�����x��{�+�q�0�I�=�=r&c��V^8d\R4hV^,^,p\P\V44pW2^,V,344,	#)z:getrandbits(k) -> x.  Generates an int with k random bits.z#number of bits must be non-negative)rQr8r9r')r!ro�numbytesr"s&&  r#rb�SystemRandom.getrandbits�sG���q�5��B�C�C���E�a�<���N�N�8�H�-�.����\�A�%�&�&r&c��\V4#)r{)r'r~s&&r#r�SystemRandom.randbytes�s����{�r&c��R#)z<Stub method.  Not used for a system random number generator.NrK�r!�args�kwdss&*,r#r�SystemRandom.seed�s��r&c��\R4h)zAMethod should not be called for a system random number generator.z*System entropy source does not have state.)�NotImplementedErrorr0s&*,r#�_notimplemented�SystemRandom._notimplemented�s��!�"N�O�Or&rKN)rrrrrrcrbrrr6rFrOr!r")r$s@r#rrxs0�����>�'���P�*�)�H�xr&c�F�^RIHpHp^RIHpV!4p\RV4Uu.uFqq!V!NK345	ppV!4p	V!V4p346V!W�4p\
V4p\V4p
\W�,347R
RVRVPV:24\RW�W�3,4R#uupi)�)�stdev�fmean)�perf_counterNz.3fz sec, z times z"avg %g, stddev %g, min %g, max %g348)349�350statisticsr:r;�timer<r��min�max�printr)rn�funcr1r:�meanr<�t0r��data�t1�xbarr�r�r�s&&&           r#�_test_generatorrH�s���/�!�	��B�!(��q�!1�2�!1�A�D�$�K�!1�D�2�	��B���:�D��$��E�351
�d�)�C��t�9�D�	�R�W�S�M���s�'�$�-�-����352A�B�	�353/�4��2J�354J�K��3s�Bc�j�\V\R4\V\R4\V\R4\V\R4\V\355R4\V\356R4\V\R4\V\R4\V\R4\V\R	4\V\R3574\V\R4\V\R4\V\R
4\V\R4\V\R4\V\R4\V\R4R#)r�NrKr)�g333333�?)�dg�?)rr)皙�����?r)rLr)r�r)g�������?r)rr)rr)g4@r)gi@r)�@rM)r�rgUUUUUU�?)358rHrcr�r�r�r
r�r�rr�)�Ns&r#�_testrO�s����A�v�r�"��A�}�j�1��A�~�z�2��A��359�3��A��360�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�9r&�fork)�after_in_childc�H�V^8�dQhR\\,R,/#)rJ�arg_listN)r�r,)�formats"r#�__annotate__rU�s��&�&�$�s�)�d�*�&r&c��^RIpVPVPRR7pVP4pVP	RRRRR7VP	R	R361\362RRR
7VP	RR\RRR
7VP	R\363RRVPR7VP	RRRR7VPV4pWBP43#)r9NT)�formatter_class�colorz-cz--choice�+zprint a random choice)�nargs�helpz-iz	--integerrNz0print a random integer between 1 and N inclusive)r;�metavarr[z-fz--floatz>print a random floating-point number between 0 and N inclusivez--test�'�?)r;�constrZr[�input�*z�if no options given, output depends on the input364    string or multiple: same as --choice365    integer: same as --integer366    float: same as --float)367�argparse�ArgumentParser�RawTextHelpFormatter�add_mutually_exclusive_group�add_argumentr8r<�SUPPRESS�368parse_args�format_help)rSrb�parser�groupr1s&    r#�_parse_argsrl�s����
�
$�
$� �5�5�T�%�C�F��/�/�1�E�	����j��
$��&�369����k��S�
?��A�370����i�e�S�
M��O�371����s�&��
�
�
�� �����s�������X�&�D��#�#�%�%�%r&c�j�V^8�dQhR\\,R,R\\,/#)rJrSN�return)r�r,r8)rTs"r#rUrUs'��$�$�4��9�t�#�$�s�S�y�$r&c���\V4wrVP'd\VP4#VPe\^VP4#VPe\^VP4#VP'd\VP4R#\VP4^8Xd,VP^,p\V4p\^V4#\VP4^8�d\VP4#V# \dH\	T4p\^T4u# \d\TP44uu#i;ii;i)N�)
rlr��integerr�r<r��testrOr1r`r8rQ�split)rSr1�	help_text�vals&   r#�mainrvs!��!�(�+�O�D��{�{�{��d�k�k�"�"��|�|���q�$�,�,�'�'��z�z���q�$�*�*�%�%��y�y�y�
�d�i�i����4�:�:��!���j�j��m��	+��c�(�C��1�c�?�"��4�:�:��!���d�j�j�!�!�����	+�
+��C�j���q�#��&���
+��c�i�i�k�*�*�
+��	+�s0�D�E.�(E�>E.�$E*�%E.�)E*�*E.�__main__)rrrr
r�r�r�r�r�rbrFr�r�rrr�rcr�r�rrOr�r�r�r�r	g�)r]rV)]r�mathrr�rr�rr�rr�rr�rr�rr�r	r�r372r�rr�rrur
r�rrrrrr�osrr'�_collections_abcrr��operatorrr��	itertoolsrr�rr�rr��_os�_random�__all__r�r�r�r r(r�r3rr�_instrrcr�r�r�r�r�r�r�r�r�r�r�r�r�r�rr
rr	rFrOrbrrHrO�hasattr�register_at_forkrlrvrrArKr&r#�<module>r�s���.�hM�L�G�G�E�E�@�@�"�2�$�B�$�����:�D��J���s��+�
��C�y���d�3�i��
���
�#��I�	���373��J�W�^�^�J�b"*�6�"*�X	����z�z��	����374�-�-��
�
�
�375�376�-�-��	�����O�O�	�	����377�-�-��378�-�-���#�#�
��%�%�������'�'���!�!��
���������'�'���#�#�
��%�%���>�>���>�>�������O�O�	�L�":�0�3��������379�380�3�&�6$�N�z��	�$�&�M�r&
codekingpro/portable-devtools · Team Ai