Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.16.156.201
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_random.pyc
�
?��cc@sQddlZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
ddlmZddl
mZdejfd��YZdefd��YZd	efd
��YZdefd��YZd
edd�Zdejfd��YZdejfd��YZdd�ZedkrMede�ndS(i����N(tlogtexptpitfsumtsin(treduce(ttest_supporttTestBasicOpscBs}eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�ZRS(
cCs&gt|�D]}|jj�^q
S(s0Helper function to make a list of random numbers(txrangetgentrandom(tselftnti((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyt
randomlistscCsY|jj�|jj�}tjd�|jj�|jj�}|j||�dS(Ng�������?(R	tseedtgetstatettimetsleeptassertNotEqual(Rtstate1tstate2((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyt
test_autoseeds


cCs^d}|jj�|jj�}|j|�}|jj|�|j||j|��dS(Ni�(R	RRRtsetstatetassertEqual(RtNtstatetrandseq((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_saverestores
cCs�xKdddddddddd	ddtd�g
D]}|jj|�q4Wx<td
�tdd�gD]}|jt|jj|�qjW|jt|jjdd�|jtt|j�g�dS(Nilili����l����i
ig��Q�	@y@tatabcitoneil F�x:^Vl F�x:^Vl���� F�x:^Vy�?@(	tNonettupleR	RtrangetdicttassertRaisest	TypeErrorttype(Rtarg((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyt
test_seedargs#s"c	Cs�|jj�|jj�}|jjd�|jj�}|j||�|jjd�|jj�}|j||�tjdt��7|jt	|jj�|jt	|jjdd�WdQXdS(Nidtquietii(
R	RRt	jumpaheadRRtcheck_py3k_warningstTrueR$R%(RRRtstate3((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_jumpahead,s
cCsZ|jjd�|jjd�x3td�D]%}|jj�}|j|d�q-WdS(Ni���l�i��)m`i�g�?(R	RR*R"R
t
assertLess(RR
tval((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyt#test_jumpahead_produces_valid_state:s
cCs�d}t|�}x~t|d�D]l}|jj||�}|jt|�|�t|�}|jt|�|�|j|t|�k�q#W|j|jjgd�g�dS(Nidii(RR	tsampleRtlentsett
assertTrue(RRt
populationtktstuniq((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_sampleBsc	Cs�d}t|�}d}d�}x�t|�D]|}||�|||�}i}xSt|�D];}d|t|jj||��<t|�|kraPqaqaW|j�q.WdS(Nii'cSsttjtd|�d�S(Ni(Rtintt__mul__R(R((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyt	factorialUs(R"RR R!R	R2R3tfail(	RRtpopttrialsR=R7texpectedtpermsR
((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_sample_distributionOs	cCs�|jjttd��d�|jjtd�d�|jjtd�d�|jjtd�d�|jjtd�d�dS(Niitabcdefghijklmnopqrst(R	R2R4R"RtstrR!(R((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_sample_inputsas
cCs|jjtjd�d�tjtd�tddd�tdd��}|jj|d�d}td�t|�D��}xWt|d	�D]E}|jj||�}x'|D]}|jt|�tk�q�Wq�W|j	�|j
|t|��dS(
NRDii
idiniicss$|]}|t||�fVqdS(N(tcomplex(t.0R
((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pys	<genexpr>tsi(R	R2R#tfromkeysR"RR5R&R;tsortR(RRRtdR7tsamptx((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_sample_on_dictsis2
!
cCs�x�d	D]�}|jj|�|jj�}|jjdd�}|jj|�|jj�}|jjdd�}|j||�|j||�qWdS(
Niii{i�i90i@�i�	i(iii{i�i90i@�i�	(R	RR
tgaussR(RRtx1ty1tx2ty2((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyt
test_gauss}s
cCs�x�ttjd�D]�}tj|j|�}gtd�D]}|jj�^q<}tj|�}gtd�D]}|j�^qs}|j||�qWdS(Nii
(	R"tpickletHIGHEST_PROTOCOLtdumpsR	RR
tloadsR(RtprotoRR
torigseqtnewgentrestoredseq((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyt
test_pickling�s(%cCstd	d
dg}x^|D]V\}}ttj|�d�}tj|�}|j�|j|jd�|�qWdS(Ns
randv2_32.pckis
randv2_64.pckibs
randv3.pckiWtrbi�(s
randv2_32.pcki(s
randv2_64.pckib(s
randv3.pckiW(topenRtfindfileRUtloadtcloseRt	randrange(Rtfilestfiletvaluetftr((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_bug_1727780�s	
(t__name__t
__module__RRRR(R.R1R:RCRFRNRTR]Ri(((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR
s								
					tWichmannHill_TestBasicOpscBs8eZej�Zd�Zd�Zd�Zd�ZRS(cCs|jt|jjd�dS(Ni(iNN(R$t
ValueErrorR	RR (R((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_setstate_first_arg�scCs�d}|jj�}|jj|�|jj�}|jj|�x!t|�D]}|jj�qQW|jj�}|j||�dS(Ni�(R	RR*R
RRR(RRR8tr1R
tr2((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_strong_jumpahead�scCs�x�d	D]�}|jj|�|jj�}|jjdd�}|jj|�|jj�}|jjdd�}|j||�|j||�qWdS(
Niii{i�i90i@�i�	i(iii{i�i90i@�i�	(R	twhseedR
ROR(RRRPRQRRRS((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_gauss_with_whseed�s
c	Cs@tj��.tjdd�|jt|jjd�WdQXdS(NterrorsUnderlying randomii<I(twarningstcatch_warningstfilterwarningsR$tUserWarningR	Rc(R((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_bigrand�s
(	RjRkR
tWichmannHillR	RnRqRsRy(((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyRl�s
		
	tSystemRandom_TestBasicOpscBs�eZej�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d	�Zd
�Zeed�ZRS(cCs|jj�dS(N(R	R(R((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR�scCs3|jt|jj�|jt|jjd�dS(N(R$tNotImplementedErrorR	RRR (R((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR�scCs|jjd�dS(Nid(R	R(R((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR(�scCs|jjd�dS(Nid(R	R*(R((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR.�scCs6d|j_|jjd�|j|jjd�dS(Nid(R R	t
gauss_nextRR(R((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyRT�scCs>x7ttjd�D]"}|jttj|j|�qWdS(Ni(R"RURVR$R|RWR	(RRY((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR]�scCsXd}d}x1td�D]#}|t|jj�|�O}qW|j||d�dS(Nii5iidiI (RR;R	R
R(RtspantcumR
((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_53_bits_per_float�s
!cCszd}d}xStd�D]E}|jj|�}|jd|koN|kn�||O}qW|j||d�dS(Nii�iidil" (RR	RcR5R(RR~RR
Rh((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyRy�s#c	Cs�x�ddddddddd	g	D]z}|jjd
|d
�}|jjd
|�}||krjq"n|j||jj||�ko�|kn�q"WdS(Ni(iPi�i�i�i�iwii&i(R	RcR5(RR
tstarttstop((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_bigrand_ranges�s(c	Cs}xvdd	dfddfgD]Y\}}|jtt||��tgtd�D]}|jj||�^qP��qWdS(Ni����iii<id(i����iII�I��������II�III(RR4R"RR	Rc(RR�R�R
((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_rangelimitss(cCsZxJtdd�D]9}|jd|jj|�koCd|kn�qW|jj}x}dddddddd	d
ddd
ddgD]K}d}x$td�D]}|||�O}q�W|j|d|d�q�W|jt|jj�|jt|jjdd�|jt|jjd�|jt|jjd�|jt|jjd�dS(Nii�iiiiii i4i5i6iwii�i�idi����g333333$@(RR5R	tgetrandbitsRR$R%Rm(RR7tgetbitsR~RR
((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_genrandbits	s77cCsLxEtdd�D]4}d|>}|d}|d||d��}|j||�|j|d|dk�||d7}|d||d��}|j|||dg�|jd||ko�d|dkn�||d?8}|d||d��}|j||�|jd||ko>d|dkn�qWdS(Nii�lgr�Z|
�?ii(RRR5tassertIn(Rt_logR;R
RtnumbitsR7((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_randbelow_logics

/(RjRkR
tSystemRandomR	RRR(R.RTR]R�RyR�R�R�RR;R�(((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR{�s											tMersenneTwister_TestBasicOpscBs�eZej�Zejd��Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd	�Zd
�Zeed�Zd�ZRS(
cCs�dtfd��Y}dtfd��Y}|jjd�|jj�}xLd|d�|d�gD]/}|jj|�|j|jj�|�qgWdS(NtBadIntcBseZd�ZRS(cSsdddS(Nig((R((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyt__abs__;s(RjRkR�(((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR�:stBadLongcBseZd�ZRS(cSsdddS(Nig((R((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR�>s(RjRkR�(((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR�=si*l*(R;tlongR	RR
R(RR�R�texpected_valuetseed_arg((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_bug_314786s"cCs|jt|jjd�dS(Ni(iNN(R$RmR	RR (R((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyRnFsc	CsV|jj�}|jt|jjd
�|jt|jjdddf�|jt|jjddddf�|jt|jjdd
dddf�|jttf��&|jjdddddf�WdQX|jttf��&|jjdddddf�WdQX|jjd	�}|jj|�|j	|jjd	�|�dS(NiiiRiqiipi����id(iNN(iii(R(i(R(i(iq(i(i����(
R	RR$R%RR Rmt
OverflowErrorR�R(Rtstart_statetbits100((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_setstate_middle_argIs"&*''c
Cs�ddddddddd	d
g
}|jjdddd�|jd�d}x3t||�D]"\}}|j||dd�qcWdS(Ng>F��dV�?g�wR1ۉ�?g�Q�"��?g~��5��?g�mb�?g�Y�KbX�?gH,r̊��?g�V���8�?g�O��ֶ?g�4�Ԗ�?l#qlGai lfi@l�$i`i�i����tplacesill`&l�'R(R	RRtziptassertAlmostEqual(RRAtactualRte((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_referenceImplementation]s	c
Cs�ddlm}ddddddd	d
ddg
}|jjd
ddd�|jd�d}x<t||�D]+\}}|jt||d��|�qsWdS(Ni����(tldexpl#�1�,ul�w�bl'�l�J�X�l�u�ak~[l@"p1ylsV�%bX$l�E3EJl�V�b�l�a�oekl�4�)[v�l#qlGai lfi@l�$i`i�i����i5ll`&l�'R(tmathR�R	RRR�RR�(RR�RAR�RR�((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyt$test_strong_reference_implementation|s	cCs"dd>d}|jj|�dS(Nli'iii�8(R	R(RR((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_long_seed�scCsXd}d}x1td�D]#}|t|jj�|�O}qW|j||d�dS(Nii5iidiI (RR;R	R
R(RR~RR
((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR��s
!cCszd}d}xStd�D]E}|jj|�}|jd|koN|kn�||O}qW|j||d�dS(Nii�iidil" (RR	RcR5R(RR~RR
Rh((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyRy�s#c	Cs�x�ddddddddd	g	D]z}|jjd
|d
�}|jjd
|�}||krjq"n|j||jj||�ko�|kn�q"WdS(Ni(iPi�i�i�i�iwii&i(R	RcR5(RR
R�R�((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR��s(c	Cs}xvdd	dfddfgD]Y\}}|jtt||��tgtd�D]}|jj||�^qP��qWdS(Ni����iii<id(i����iII�I��������II�III(RR4R"RR	Rc(RR�R�R
((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR��s(cCs�|jjd�|j|jjd�d�xJtdd�D]9}|jd|jj|�kood|kn�q<W|jj}x}dddd	d
dddd
dddddgD]K}d}x$td�D]}|||�O}q�W|j|d|d�q�W|jt|jj�|jt|jjd�|jt|jjdd�|jt|jjd�|jt|jjd�dS(Ni��idlS!m�.vFXOii�iiiiii i4i5i6iwii�i�Ri����(	R	RRR�RR5R$R%Rm(RR7R�R~RR
((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR��s 77cCsLxEtdd�D]4}d|>}|d}|d||d��}|j||�|j|d|dk�||d7}|d||d��}|j|||dg�|jd||ko�d|dkn�||d?8}|d||d��}|j||�|jd||ko>d|dkn�qWdS(Nii�lgr�Z|
�?ii(RRR5R�(RR�R;R
RR�R7((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR��s

/cCsid}d}d}|jj|||�}|j||koG|kn�|j|||d�dS(NI���l���� F�x:^Vi8���i(R	RcR5R(RR�R�tstepRM((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_randrange_bug_1590891�s#(RjRkR
tRandomR	Rtcpython_onlyR�RnR�R�R�R�R�RyR�R�R�RR;R�R�(((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR�3s											g@g�?c
Cs�|dkr,ttt|�td|�S|d}||dt|�|tdd|d|dd|dd	|d
d|dd
|dd|dd|dg	�S(Ng�?g�?g@g
����?g�
ö)$�@g&Ԏ����g
t�a��@g@g���Q�f�g@g>@~�)@g@gA~�����g@g�~\���>g@g���i�E�>g@(RRtgammaRR(tztsqrt2pitaz((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR��s 
tTestDistributionscBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs�tj�}gtd�D]}|j�^qdgd}|j|_|jdd�|j|_|jd�|j|_|jd�|j|_|jdd�|j|_|jdd�|j|_|j	dd�|j|_|j
dd�|j|_|jdd�|j|_|jdd�|j|_|jdd�|j|_|jdd�|j|_|jdd�|j|_|j
d	d	�|j|_|jdddd	�dS(
Ni2giii
g�?g{�G�z�?gi@g@(R
R�RR?tuniformt
paretovariatetexpovariatetweibullvariatetvonmisesvariatet
normalvariateROtlognormvariatetgammavariatetbetavariatet
triangular(RtgR
RM((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_zeroinputss<0















c

Cs6tj�}d}gtd|�D]}|t|�^q"}x�|jdddddf|jddddfd	d
dd
df|jddd
ddf|jdttddf|j	dddddd f|j
d!tddd�tddd�tddd�dfgD]\}}}}|j|_g}	xEtt
|��D]1}y|	j||��WqXtk
r�qXXqXWd}
}x*|	D]"}|
|7}
|||d7}q�Wt
|	�}|j|
||dddd|j|f�|j||d|dddd|j|f�q WdS("Ni�ig�?g$@iigg@g@g"@g@g2@g�?g�G�z��?iig@R�tmsgs%s%r(g�?g$@g&@g"@g@T@(g�?g@(g�G�z��?i(g@g@g@g0@g@(g�?g@(R
R�RtfloatR�R�R�R�RR�R�R�R?R3tappendt
IndexErrorR�Rj(
RR�RR
RMtvariatetargstmut	sigmasqrdtyts1ts2R�((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_avg_stds8,+@




cCsHtj�}d}x/|jddf|jddf|jd	df|jtd�fdf|jdtd�fdf|jd
df|jddf|jtd�dfdf|j	ddf|j
td�fdf|jdtd�fdf|jd
dfgD]<\}}}x*t|�D]}|j
||�|�q WqWdS(Nidg$@tinfgg@g�?(g$@g$@(g$@g$@(g$@g$@g$@(g$@g(gg(g$@g(gg$@(R
R�R�R�R�R�R�ROR�R�R�R�R"R(RR�RR�R�RAR
((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyt
test_constant6s""c
Cs�tj�}d}x�dD]{}xrdD]j}xat|�D]S}|j||�}|jd|koqtjknd	d
j|||��q9Wq&WqWdS(
Nidgg�������?g������@g������@gffffff@g@@iR�sCvonmisesvariate({}, {}) produced a result {} out of range [0, 2*pi](gg�������?g������@g������@(ggffffff@g@@(R
R�R"R�R5tTWOPItformat(RR�RR�tkappat_R2((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_von_mises_rangeJs

cCs$tjdd�tjdd�dS(Nig4&�kCg}Ô%�I�T(R
R�(R((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest_von_mises_large_kappaXs(RjRkR�R�R�R�R�(((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR�s
		 		t
TestModulecBs#eZd�Zd�Zd�ZRS(cCsP|jtjd�|jtjd�|jtjd�|jtjd�dS(Ng�3?�r�?g�.DT�!@g�9��B.�?g�t�Y@(R�R
t
NV_MAGICCONSTR�tLOG4t
SG_MAGICCONST(R((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttestMagicConstants_scCs,|jttj�ttt��k�dS(N(R5R4R
t__all__tdir(R((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyttest__all__escCs*dtjfd��Y}|dd�dS(NtSubclasscBseZdd�ZRS(cSstjj|�dS(N(R
R�t__init__(Rtnewarg((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR�lsN(RjRkR R�(((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR�ksR�i(R
R�(RR�((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyt test_random_subclass_with_kwargsis(RjRkR�R�R�(((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyR�^s		cCs�ttttg}ytj�j�Wntk
r9nX|jt�t	j
|�ddl}|r�t|d�r�dgd}x7tt|��D]#}t	j
|�|j�||<q�W|GHndS(Ni����tgettotalrefcounti(RlR�R�R�R
R�R|R�R{Rtrun_unittesttsysthasattrR RR3R�(tverbosettestclassesR�tcountsR
((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyt	test_mainqs"	




t__main__R�(tunittestR
RRURuR�RRRRRt	functoolsRttestRtTestCaseRRlR{R�R�R�R�R R�RjR,(((s7/usr/local/python-2.7/lib/python2.7/test/test_random.pyt<module>s"(�*f�\
© 2025 GrazzMean