KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/22697/root/usr/lib64/python2.4/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/22697/root/usr/lib64/python2.4/random.pyc
mò
‚=5Dc@scdZdklZdklZlZdk	l
ZlZ
lZlZdk	lZlZlZlZdklZdklZddd	d
ddd
dddddddddddddddddgZ de
d ƒed!ƒZ!d!eZ"ed"ƒZ#d#ed$ƒZ$d%Z%d&e%Z&d'k'Z'de'i(fd(„ƒYZ(de(fd)„ƒYZ)de(fd*„ƒYZ*d+„Z+d,d-„Z,e(ƒZ-e-i.Z.e-i/Z/e-i0Z0e-i1Z1e-i2Z2e-i3Z3e-i4Z4e-i5Z5e-i6Z6e-i7Z7e-i8Z8e-i9Z9e-i:Z:e-i;Z;e-i<Z<e-i=Z=e-i>Z>e-i?Z?e-i@Z@e-iAZAe-iBZBeCd.joe,ƒnd'S(/s;Random variable generators.

    integers
    --------
           uniform within range

    sequences
    ---------
           pick random element
           pick random sample
           generate random permutation

    distributions on the real line:
    ------------------------------
           uniform
           normal (Gaussian)
           lognormal
           negative exponential
           gamma
           beta
           pareto
           Weibull

    distributions on the circle (angles 0 to 2pi)
    ---------------------------------------------
           circular uniform
           von Mises

General notes on the underlying Mersenne Twister core generator:

* The period is 2**19937-1.
* It is one of the most extensively tested generators in existence
* Without a direct way to compute N steps forward, the
  semantics of jumpahead(n) are weakened to simply jump
  to another distant state and rely on the large period
  to avoid overlapping sequences.
* The random() method is implemented in C, executes in
  a single Python step, and is, therefore, threadsafe.

(swarn(s
MethodTypesBuiltinMethodType(slogsexpspite(ssqrtsacosscosssin(surandom(shexlifytRandomtseedtrandomtuniformtrandinttchoicetsamplet	randrangetshufflet
normalvariatetlognormvariatetexpovariatetvonmisesvariatetgammavariatetgausstbetavariatet
paretovariatetweibullvariatetgetstatetsetstatet	jumpaheadtWichmannHilltgetrandbitstSystemRandomif0.5f2.0f4.0f1.0f4.5i5iNcBstZdZdZed„Zed„Zd„Zd„Zd„Z	d„Z
d„Zed	eed
e
>d„Zd„Zeed
e
>eed
„Zd„Zeed„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z RS(sÑRandom number generator base class used by bound module functions.

    Used to instantiate instances of Random to get generators that don't
    share state.  Especially useful for multi-threaded programs, creating
    a different instance of Random for each thread, and using the jumpahead()
    method to ensure that the generated sequences seen by each thread don't
    overlap.

    Class Random can also be subclassed if you want to use a different basic
    generator of your own devising: in that case, override the following
    methods:  random(), seed(), getstate(), setstate() and jumpahead().
    Optionally, implement a getrandombits() method so that randrange()
    can cover arbitrarily large ranges.

    icCs|i|ƒd|_dS(seInitialize an instance.

        Optional argument x controls seeding, as for Random.seed().
        N(tselfRtxtNonet
gauss_next(RR((t/usr/lib64/python2.4/random.pyt__init__Ys
cCsˆ|djoXytttdƒƒdƒ}Wqetj
o&dk}t|iƒdƒ}qeXntt|ƒi
|ƒd|_dS(sInitialize internal state from hashable object.

        None or no argument seeds from current time or from an operating
        system specific randomness source if available.

        If a is not None or an int or long, hash(a) is used instead.
        iNi(taRtlongt_hexlifyt_urandomtNotImplementedErrorttimetsuperRRRR(RRR$((RRbs
	cCs"|itt|ƒiƒ|ifS(s9Return internal state; can be passed to setstate() later.N(RtVERSIONR%RRR(R((RRuscCs`|d}|djo,|\}}|_tt|ƒi|ƒntd||i	fƒ‚dS(s:Restore internal state from object returned by getstate().iis?state with version %s passed to Random.setstate() of version %sN(
tstatetversiont
internalstateRRR%RRt
ValueErrorR&(RR'R(R)((RRys

cCs
|iƒS(N(RR(R((Rt__getstate__‰scCs|i|ƒdS(N(RRR'(RR'((Rt__setstate__ŒscCs|if|iƒfS(N(Rt	__class__R(R((Rt
__reduce__silcCs||ƒ}||jo
td‚n||joP|djo6||jo|i|ƒSn||i	ƒ|ƒSntd‚n||ƒ}
|
|jo
td‚n|
|}|djoW|djoJ||jo|||i|ƒƒSn||||i	ƒ|ƒƒSn|djotd||
|f‚n||ƒ}||jo
td‚n|djo||d|}	n-|djo||d|}	n
td‚|	djo
td‚n|	|jo||i|	ƒSn||||i	ƒ|	ƒS(
sChoose a random item from range(start, stop[, step]).

        This fixes the problem with randint() which includes the
        endpoint; in Python this is usually not what you want.
        Do not supply the 'int', 'default', and 'maxwidth' arguments.
        s!non-integer arg 1 for randrange()isempty range for randrange()s non-integer stop for randrange()is'empty range for randrange() (%d,%d, %d)s non-integer step for randrange()szero step for randrange()N(tinttstarttistartR*tstoptdefaulttmaxwidthRt
_randbelowRtistoptwidthtsteptisteptn(RR0R2R8R/R3R4R1R7R:R6R9((RR”sB









"




	


cCs|i||dƒS(sJReturn random integer in range [a, b], including both end points.
        iN(RRRtb(RRR;((RRÔsc
CsÍy
|i}	Wntj
on}Xt|iƒ|jpt|	ƒ|joR|d||ddƒƒ}|	|ƒ}x||jo|	|ƒ}qxW|Sn||jot
dƒn||iƒ|ƒS(s£Return a random int in the range [0,n)

        Handles the case where n has more bits than returned
        by a single call to the underlying generator.
        f1.0000100000000001if2.0sgUnderlying random() generator does not supply 
enough bits to choose from a population range this largeN(RRtAttributeErrorttypeRt_BuiltinMethodt_MethodR/t_logR:tktrt	_maxwidtht_warn(
RR:R@R/RCR?R>RBRAR((RR5Ús
)

cCs|t|iƒt|ƒƒS(s2Choose a random element from a non-empty sequence.N(tseqR/RRtlen(RRE((RR÷scCsx|djo
|i}nxWttdt|ƒƒƒD]:}||ƒ|dƒ}||||||<||<q6WdS(sÓx, random=random.random -> shuffle list x in place; return None.

        Optional arg random is a 0-argument function returning a random
        float in [0.0, 1.0); by default, the standard random.random.

        Note that for even rather small len(x), the total number of
        permutations of x is larger than the period of most random number
        generators; this implies that "most" permutations of a long
        sequence can never be generated.
        iN(
RRRtreversedtxrangeRFRtiR/tj(RRRR/RJRI((RR	ûs


cCs’t|ƒ}d|jo
|jnp
td‚n|i}t}dg|}|d|jobt|ƒ}
xt
|ƒD]A}||ƒ||ƒ}|
|||<|
||d|
|<q}WnÉy2|djo!|d||d||dfWn%ttfj
ot|ƒ}nXh}	xet
|ƒD]W}||ƒ|ƒ}x%||	jo||ƒ|ƒ}qOW||||<|	|<q3W|S(s8Chooses k unique random elements from a population sequence.

        Returns a new list containing elements from the population while
        leaving the original population unchanged.  The resulting list is
        in selection order so that all sub-slices will also be valid random
        samples.  This allows raffle winners (the sample) to be partitioned
        into grand prize and second place winners (the subslices).

        Members of the population need not be hashable or unique.  If the
        population contains repeats, then each occurrence is a possible
        selection in the sample.

        To choose a sample in a range of integers, use xrange as an argument.
        This is especially fast and space efficient for sampling from a
        large population:   sample(xrange(10000000), 60)
        issample larger than populationiiiN(RFt
populationR:RAR*RRR/t_intRtresulttlisttpoolRHRIRJt	TypeErrortKeyErrorttupletselected(RRKRARJRLRR:RIRMRSRO((RRs6

	

2

cCs||||iƒS(s(Get a random number in the range [a, b).N(RR;RR(RRR;((RRHscCsl|i}xT|ƒ}d|ƒ}t|d|}||d}|t|ƒjoPqqW|||S(s\Normal distribution.

        mu is the mean, and sigma is the standard deviation.

        if1.0f0.5f4.0N(
RRtu1tu2t
NV_MAGICCONSTtztzzR@tmutsigma(RRYRZRRTRURXRW((RR
Ns		

cCst|i||ƒƒS(sûLog normal distribution.

        If you take the natural logarithm of this distribution, you'll get a
        normal distribution with mean mu and standard deviation sigma.
        mu can have any value, and sigma must be greater than zero.

        N(t_expRR
RYRZ(RRYRZ((RRgscCs?|i}|ƒ}x|djo
|ƒ}qWt|ƒ|S(sìExponential distribution.

        lambd is 1.0 divided by the desired mean.  (The parameter would be
        called "lambda", but that is a reserved word in Python.)  Returned
        values range from 0 to positive infinity.

        f9.9999999999999995e-08N(RRtuR@tlambd(RR]RR\((RRss		
cCs<|i}|djot|ƒSndtdd||ƒ}|td|ƒd|}d||d|}x€|ƒ}t	t
|ƒ}
d||
||
}|||}|ƒ}
|
|d|jp|
|td|ƒjoPqvqvW|ƒ}	|	djo|tt|ƒ}n|tt|ƒ}|S(sFCircular data distribution.

        mu is the mean angle, expressed in radians between 0 and 2*pi, and
        kappa is the concentration parameter, which must be greater than or
        equal to zero.  If kappa is equal to zero, this distribution reduces
        to a uniform random angle over the range 0 to 2*pi.

        f9.9999999999999995e-07f1.0f4.0f2.0if0.5N(RRtkappatTWOPIt_sqrtRR;RBRTt_cost_piRWtftcRUR[tu3RYt_acosttheta(RRYR^RR;RcRdRRTReRURBRgRW((RR
†s*	
		0
	
cCs)|djp
|djo
td‚n|i}|djoïtd|dƒ}|t}||}x½|ƒ}d|jo
djnpqhnd|ƒ}t|d|ƒ|}|t|ƒ}
|||}||||
}
|
td|djp|
t|ƒjo|
|SqhqhWnú|djo:|ƒ}x|djo
|ƒ}qEWt|ƒ|Sn³x§|ƒ}t|t}||}	|	djo|	d|}
nt||	|ƒ}
|ƒ}|	djo||
|djoPqqv|t|
ƒjoPqvqvW|
|Sd	S(
sxGamma distribution.  Not the gamma function!

        Conditions on the parameters are alpha > 0 and beta > 0.

        f0.0s*gammavariate: alpha and beta must be > 0.0f1.0f2.0if9.9999999999999995e-08f0.99999990000000005f4.5N(talphatbetaR*RRR`tainvtLOG4tbbbtcccRTRUR@tvR[RRWRBt
SG_MAGICCONSTR\t_eR;tp(RRhRiRRjRTRlRUR;RqRBR\RnRRWRm((RR¸sR
	


	
,
	
	

	
	
cCs…|i}|i}d|_|djoQ|ƒt}tdtd|ƒƒƒ}t
|ƒ|}t|ƒ||_n|||S(sØGaussian distribution.

        mu is the mean, and sigma is the standard deviation.  This is
        slightly faster than the normalvariate() function.

        Not thread-safe without a lock around calls.

        f-2.0f1.0N(RRRRWRR_tx2piR`R@tg2radRat_sinRYRZ(RRYRZRRrRWRs((RRús			

cCsC|i|dƒ}|djodSn|||i|dƒSdS(sBeta distribution.

        Conditions on the parameters are alpha > -1 and beta} > -1.
        Returned values range between 0 and 1.

        f1.0if0.0N(RRRhtyRi(RRhRiRu((RR/s

cCs%d|iƒ}dt|d|ƒS(s3Pareto distribution.  alpha is the shape parameter.f1.0N(RRR\tpowRh(RRhR\((RRAscCs,d|iƒ}|tt|ƒd|ƒS(sfWeibull distribution.

        alpha is the scale parameter and beta is the shape parameter.

        f1.0N(RRR\RhRvR@Ri(RRhRiR\((RRJs(!t__name__t
__module__t__doc__R&RRRRRR+R,R.R/tBPFRRR@t_MethodTypet_BuiltinMethodTypeR5RR	RRR
RRR
RRRRR(((RRFs2						@			:					2	B	5			cBs\tZdZdd„Zd„Zd„Zd„Zd„Zdddd„Z	dd	„Z
RS(
NicCs|djoXytttdƒƒdƒ}Wqetj
o&dk}t|iƒdƒ}qeXnt|ttfƒpt	|ƒ}nt
|dƒ\}}t
|dƒ\}}t
|dƒ\}}t|ƒdt|ƒdt|ƒdf|_d|_dS(süInitialize internal state from hashable object.

        None or no argument seeds from current time or from an operating
        system specific randomness source if available.

        If a is not None or an int or long, hash(a) is used instead.

        If a is an int or long, a is used directly.  Distinct values between
        0 and 27814431486575L inclusive are guaranteed to yield distinct
        internal states (this guarantee is specific to the default
        Wichmann-Hill generator).
        iNii<vibvirvi(RRR R!R"R#R$t
isinstanceR/thashtdivmodRRuRWRt_seedR(RRRWR$RuR((RR[s
	0cCsj|i\}}}d|d}d|d}d|d}|||f|_|d|d|d	d
S(s3Get the next random number in the range [0.0, 1.0).i«i=vi¬icviªisvf30269.0f30307.0f30323.0f1.0N(RR€RRuRW(RRuRRW((RRzscCs|i|i|ifS(s9Return internal state; can be passed to setstate() later.N(RR&R€R(R((RR™scCsM|d}|djo|\}|_|_ntd||ifƒ‚dS(s:Restore internal state from object returned by getstate().iis?state with version %s passed to Random.setstate() of version %sN(R'R(RR€RR*R&(RR'R(((RRs


cCs¥|djptdƒ‚n|i\}}}t|td|dƒƒd}t|td|dƒƒd}t|td|dƒƒd}|||f|_d	S(
sÃAct as if n calls to random() were made, but quickly.

        n is an int, greater than or equal to 0.

        Example use:  If you have 2 threads and know that each will
        consume no more than a million random numbers, create two Random
        objects r1 and r2, then do
            r2.setstate(r1.getstate())
            r2.jumpahead(1000000)
        Then r1 and r2 will use guaranteed-disjoint segments of the full
        period.
        isn must be >= 0i«i=vi¬icviªisvN(	R:R*RR€RRuRWR/Rv(RR:RuRRW((RR§s
   icCsŽt|ƒt|ƒjot|ƒjo
tjnptdƒ‚nd|jo
djno9d|jo
djnod|jo
djnptdƒ‚nd|jo|jo
|jnozdk}t|iƒdƒ}t|d@|d?Aƒ}t
|dƒ\}}t
|dƒ\}}t
|dƒ\}}n|pd|pd|pdf|_d|_dS(	sjSet the Wichmann-Hill seed from (x, y, z).

        These must be integers in the range [0, 256).
        sseeds must be integersiisseeds must be in range(0, 256)Niÿÿÿii(R=RRuRWR/RPR*R$R ttRRR€RR(RRRuRWRR$((Rt__whseed½s<Z*	'cCsÀ|djo|iƒdSnt|ƒ}t|dƒ\}}t|dƒ\}}t|dƒ\}}||dpd}||dpd}||dpd}|i|||ƒdS(sbSeed from hashable object's hash code.

        None or no argument seeds from current time.  It is not guaranteed
        that objects with distinct hash codes lead to distinct internal
        states.

        This is obsolete, provided for compatibility with the seed routine
        used prior to Python 2.1.  Use the .seed() method instead.
        Nii(	RRRt_WichmannHill__whseedR~RRRuRW(RRRuRRW((RtwhseedÔs	

(RwRxR&RRRRRRRƒR„(((RRWs			
	cBsFtZdZd„Zd„Zd„ZeZZd„ZeZ	Z
RS(sÝAlternate random number generator using sources provided
    by the operating system (such as /dev/urandom on Unix or
    CryptGenRandom on Windows).

     Not available on all systems (see os.urandom() for details).
    cCs!tttdƒƒdƒd?tS(s3Get the next random number in the range [0.0, 1.0).iiiN(R R!R"t	RECIP_BPF(R((RRõscCsy|djotdƒ‚n|t|ƒjotdƒ‚n|dd}ttt|ƒƒdƒ}||d|?S(s>getrandbits(k) -> x.  Generates a long int with k random bits.is(number of bits must be greater than zeros#number of bits should be an integeriiiN(	RAR*R/RPtbytesR R!R"R(RRAR†R((RRùs
cOsdS(s<Stub method.  Not used for a system random number generator.N(R(Rtargstkwds((Rt_stubscOstdƒ‚dS(sAMethod should not be called for a system random number generator.s*System entropy source does not have state.N(R#(RR‡Rˆ((Rt_notimplementeds(RwRxRyRRR‰RRRŠRR(((RRís		
	
	cCsòdk}	|GdG|iGHd}d}d}d}|	iƒ}xVt	|ƒD]H}||Œ}
||
7}||
|
}t
|
|ƒ}t|
|ƒ}qJW|	iƒ}t||dƒGdG||}t||||ƒ}
d||
||fGHdS(Nttimesf0.0f
10000000000.0f-10000000000.0issec,s!avg %g, stddev %g, min %g, max %g(R$R:tfuncRwttotaltsqsumtsmallesttlargesttt0trangeRIR‡Rtmintmaxtt1troundtavgR`tstddev(R:RŒR‡R—RRIR‘RRŽR$RRR•R˜((Rt_test_generators&	


iÐcCsôt|tfƒ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(Nf0.0f1.0f0.01f0.10000000000000001f2.0f0.5f0.90000000000000002f20.0f200.0f3.0(f0.0f1.0(f0.0f1.0(f0.0f1.0(f0.01f1.0(f0.10000000000000001f1.0(f0.10000000000000001f2.0(f0.5f1.0(f0.90000000000000002f1.0(f1.0f1.0(f2.0f1.0(f20.0f1.0(f200.0f1.0(f0.0f1.0(f3.0f3.0(	R™tNRR
RR
RRR(Rš((Rt_test%st__main__(DRytwarningstwarnRDttypest
MethodTypeR{tBuiltinMethodTypeR|tmathtlogR@texpR[tpiRbRRptsqrtR`tacosRftcosRatsinRttosturandomR"tbinasciithexlifyR!t__all__RVR_RkRoRzR…t_randomRRRR™R›t_instRRRRRRRR	R
RRR
RRRRRRRRRRw(0RRtR[RRzRfR¯R›RRR
RRRRR	RR_R®RR
RbRRRRpRRRRRaR"RRRRR@R|R!R…R°R™RoRDR{RkR`RV((Rt?(sZ


N
	ÿÿ–"																							


Anon7 - 2021