HEX

Warning: set_time_limit() [function.set-time-limit]: Cannot set time limit - prohibited by configuration in /home/u547966/brikov.ru/www/wp-content/plugins/admin-menu-editor/menu-editor.php on line 745
Server: Apache
System: Linux 4.19.0-0.bpo.9-amd64 x86_64 at red40
User: u547966 (5490)
PHP: 5.3.29-mh2
Disabled: syslog, dl, popen, proc_open, proc_nice, proc_get_status, proc_close, proc_terminate, posix_mkfifo, chown, chgrp, accelerator_reset, opcache_reset, accelerator_get_status, opcache_get_status, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_exec, pcntl_getpriority, pcntl_setpriority
Upload Files
File: //usr/lib/python3.5/__pycache__/random.cpython-35.pyc


Fa_g@s|dZddlmZddlmZmZddl	m
ZmZ
mZmZmZddl	mZmZmZmZddlmZddlm Z!m"Z#ddl$m%Z&d	d
ddd
ddddddddddddddddddgZ'd e
d!ed"Z(d"eZ)ed#Z*d$ed%Z+d&Z,d'e,Z-dd(l.Z.Gd)d	d	e.j/Z/Gd*dde/Z0d+d,Z1d-d.d/Z2e/Z3e3j4Z4e3j5Z5e3j6Z6e3j7Z7e3j8Z8e3j9Z9e3j:Z:e3j;Z;e3j<Z<e3j=Z=e3j>Z>e3j?Z?e3j@Z@e3jAZAe3jBZBe3jCZCe3jDZDe3jEZEe3jFZFe3jGZGe3jHZHeId0krxe2d(S)1aRandom variable generators.

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

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

    distributions on the real line:
    ------------------------------
           uniform
           triangular
           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.
* The random() method is implemented in C, executes in a single Python step,
  and is, therefore, threadsafe.

)warn)
MethodTypeBuiltinMethodType)logexppieceil)sqrtacoscossin)urandom)SetSequence)sha512Randomseedrandomuniformrandintchoicesample	randrangeshuffle
normalvariatelognormvariateexpovariatevonmisesvariategammavariate
triangulargaussbetavariate
paretovariateweibullvariategetstatesetstategetrandbitsSystemRandomg?g@g@g?g@5NcseZdZdZdZdddZddfddZfd	d
ZfddZd
dZ	ddZ
ddZddeddZ
ddZede>eeeddZddZdddZddZd d!Zd"d#dd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Z d6d7Z!S)8raRandom number generator base class used by bound module functions.

    Used to instantiate instances of Random to get generators that don't
    share state.

    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(), and setstate().
    Optionally, implement a getrandbits() method so that randrange()
    can cover arbitrarily large ranges.

    NcCs|j|d|_dS)zeInitialize an instance.

        Optional argument x controls seeding, as for Random.seed().
        N)r
gauss_next)selfxr0/usr/lib/python3.5/random.py__init__Ts
zRandom.__init__r+c
su|dkr_ytjtdd}Wn4tk
r^ddl}t|jd}YnX|dkrt|ttfr|rt|dd>nd}x&|D]}d|t|Ad	@}qW|t	|N}|dkrdn|}|d
krXt|ttt
frXt|tr0|j}|t|j
7}tj|d}tj|d|_dS)
aInitialize 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 an int, all bits are used.

        For version 2 (the default), all of the bits are used if *a* is a str,
        bytes, or bytearray.  For version 1 (provided for reproducing random
        sequences from older versions of Python), the algorithm for str and
        bytes generates a narrower range of seeds.

        Ni	bigriCBlr+)int
from_bytes_urandomNotImplementedErrortime
isinstancestrbytesordlen	bytearrayencode_sha512Zdigestsuperrr-)r.aversionr=r/c)	__class__r0r1r]s(
! 
zRandom.seedcs|jtj|jfS)z9Return internal state; can be passed to setstate() later.)VERSIONrFr%r-)r.)rJr0r1r%szRandom.getstatecs|d}|dkr;|\}}|_tj|n|dkr|\}}|_ytdd|D}Wn.tk
r}zt|WYdd}~XnXtj|ntd||jfdS)z:Restore internal state from object returned by getstate().rr,r+css|]}|dVqdS)r+ Nlr0).0r/r0r0r1	<genexpr>sz"Random.setstate.<locals>.<genexpr>Nz?state with version %s passed to Random.setstate() of version %s)r-rFr&tuple
ValueError	TypeErrorrK)r.staterHZ
internalstater)rJr0r1r&s
zRandom.setstatecCs
|jS)N)r%)r.r0r0r1__getstate__szRandom.__getstate__cCs|j|dS)N)r&)r.rRr0r0r1__setstate__szRandom.__setstate__cCs|jf|jfS)N)rJr%)r.r0r0r1
__reduce__szRandom.__reduce__r5c
Csp||}||kr$td|dkrU|dkrI|j|Std||}||krytd||}|dkr|dkr||j|S|dkrtd|||f||}||krtd|dkr||d|}	n-|dkr7||d|}	ntd	|	dkr[td|||j|	S)
zChoose 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.

        z!non-integer arg 1 for randrange()Nrzempty range for randrange()z non-integer stop for randrange()r5z'empty range for randrange() (%d,%d, %d)z non-integer step for randrange()zzero step for randrange())rP
_randbelow)
r.startstopstep_intZistartZistopwidthZistepnr0r0r1rs4


zRandom.randrangecCs|j||dS)zJReturn random integer in range [a, b], including both end points.
        r5)r)r.rGbr0r0r1rszRandom.randintc
Cs|j}|j}|||ks6|||krq|j}	||	}
x|
|krl||	}
qQW|
S||krtd|||S||}|||}|}
x|
|kr|}
qW||
||S)zCReturn a random int in the range [0,n).  Raises ValueError if n==0.zUnderlying random() generator does not supply 
enough bits to choose from a population range this large.
To remove the range limitation, add a getrandbits() method.)rr'
bit_length_warn)
r.r\r9maxsizetypeZMethodZ
BuiltinMethodrr'krZremlimitr0r0r1rVs"		$

	
zRandom._randbelowcCsBy|jt|}Wntk
r9tdYnX||S)z2Choose a random element from a non-empty sequence.z$Cannot choose from an empty sequence)rVrBrP
IndexError)r.seqir0r0r1rs

z
Random.choicecCs|dkrk|j}xttdt|D]3}||d}||||||<||<q1Wn`t}xWttdt|D]:}|||d}||||||<||<qWdS)zShuffle list x in place, and return None.

        Optional argument random is a 0-argument function returning a
        random float in [0.0, 1.0); if it is the default None, the
        standard random.random will be used.

        Nr5)rVreversedrangerBr9)r.r/r	randbelowrgjrZr0r0r1rs		"$"zRandom.shufflecCst|trt|}t|ts6td|j}t|}d|kob|knsstddg|}d}|dkr|dtt	|dd7}||krt
|}xt|D]:}|||}	||	||<|||d	||	<qWnlt}
|
j
}xWt|D]I}||}	x|	|
krh||}	qMW||	||	||<q8W|S)
a=Chooses k unique random elements from a population sequence or set.

        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 range as an argument.
        This is especially fast and space efficient for sampling from a
        large population:   sample(range(10000000), 60)
        z>Population must be a sequence or set.  For dicts, use list(d).rzSample larger than populationNr)r,r5)r>_SetrO	_SequencerQrVrBrP_ceil_loglistrisetadd)r.Z
populationrbrjr\resultZsetsizeZpoolrgrkZselectedZselected_addr0r0r1r!s6	
!		
z
Random.samplecCs||||jS)zHGet a random number in the range [a, b) or [a, b] depending on rounding.)r)r.rGr]r0r0r1r_szRandom.uniformgg?cCs|j}y(|dkr!dn||||}Wntk
rL|SYnX||krzd|}d|}||}}|||||dS)zTriangular distribution.

        Continuous distribution bounded by given lower and upper limits,
        and having a given mode value in-between.

        http://en.wikipedia.org/wiki/Triangular_distribution

        Ng?g?)rZeroDivisionError)r.ZlowZhighmodeurIr0r0r1r es	(
	


zRandom.triangularcCsf|j}xN|}d|}t|d|}||d}|t|krPqW|||S)z\Normal distribution.

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

        g?g?g@)r
NV_MAGICCONSTrq)r.musigmaru1u2zZzzr0r0r1r{s
		
zRandom.normalvariatecCst|j||S)zLog 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.

        )_expr)r.rzr{r0r0r1rszRandom.lognormvariatecCstd|j|S)a^Exponential distribution.

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

        g?)rqr)r.Zlambdr0r0r1rszRandom.expovariatecCs|j}|dkr t|Sd|}|td||}xc|}tt|}|||}|}	|	d||ks|	d|t|krEPqEWd|}
|
|d|
|}|}|dkr|t|t}
n|t|t}
|
S)aFCircular 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.

        gư>g?g?)rTWOPI_sqrt_cos_pir_acos)r.rzZkapparsrcr|r~dr}qfZu3Zthetar0r0r1rs&	
		.
	zRandom.vonmisesvariatecCs|dks|dkr$td|j}|dkrtd|d}|t}||}x|}d|kodknsqdd|}t|d||}	|t|	}
|||}|||	|
}|td|dks|t|krd|
|SqdWn|dkrZ|}
x|
dkrJ|}
q2Wt|
|Sx|}
t|t}||
}|dkr|d|}
nt|||}
|}|dkr||
|dkrPq]|t|
kr]Pq]W|
|SdS)	aZGamma distribution.  Not the gamma function!

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

        The probability distribution function is:

                    x ** (alpha - 1) * math.exp(-x / beta)
          pdf(x) =  --------------------------------------
                      math.gamma(alpha) * beta ** alpha

        gz*gammavariate: alpha and beta must be > 0.0g?g@gHz>gP?g@N)rPrrLOG4rqr
SG_MAGICCONST_e)r.alphabetarZainvZbbbZcccr|r}vr/r~rcrxr]pr0r0r1rsJ	

	
*	
	
	zRandom.gammavariatecCs|j}|j}d|_|dkrt|t}tdtd|}t||}t|||_|||S)zGaussian 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.

        Ng@g?g)rr-rrrqr_sin)r.rzr{rr~Zx2piZg2radr0r0r1r!+s			
zRandom.gausscCs>|j|d}|dkr"dS|||j|dSdS)zBeta distribution.

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

        g?rgN)r)r.rryr0r0r1r"`s
zRandom.betavariatecCs d|j}d|d|S)z3Pareto distribution.  alpha is the shape parameter.g?)r)r.rrxr0r0r1r#rszRandom.paretovariatecCs'd|j}|t|d|S)zfWeibull distribution.

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

        g?)rrq)r.rrrxr0r0r1r${szRandom.weibullvariate)"__name__
__module____qualname____doc__rKr2rr%r&rSrTrUr9rrBPFra_MethodType_BuiltinMethodTyperVrrrrr rrrrrr!r"r#r$r0r0)rJr1rDs6	),
>0H5	c@sPeZdZdZddZddZddZdd	ZeZZ	d
S)r(zAlternate 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).
    cCstjtddd?tS)z3Get the next random number in the range [0.0, 1.0).r6r3r,)r9r:r;	RECIP_BPF)r.r0r0r1rszSystemRandom.randomcCsl|dkrtd|t|kr6td|dd}tjt|d}||d|?S)z:getrandbits(k) -> x.  Generates an int with k random bits.rz(number of bits must be greater than zeroz#number of bits should be an integerr6r3)rPr9rQr:r;)r.rbZnumbytesr/r0r0r1r'szSystemRandom.getrandbitscOsdS)z<Stub method.  Not used for a system random number generator.Nr0)r.argskwdsr0r0r1rszSystemRandom.seedcOstddS)zAMethod should not be called for a system random number generator.z*System entropy source does not have state.N)r<)r.rrr0r0r1_notimplementedszSystemRandom._notimplementedN)
rrrrrr'rrr%r&r0r0r0r1r(s
cCsddl}t|d|jd}d}d}d
}|j}xVt|D]H}	||}
||
7}||
|
}t|
|}t|
|}qPW|j}tt||dddd||}t||||}
td	||
||fdS)Nrtimesgg _Br,zsec,end z"avg %g, stddev %g, min %g, max %g
g _)r=printrriminmaxroundr)r\funcrr=ZtotalZsqsumZsmallestZlargestZt0rgr/Zt1ZavgZstddevr0r0r1_test_generators&
 
ricCst|tft|tdt|tdt|td
t|tdt|tdt|tdt|tdt|tdt|tdt|tdt|tdt|tdt|tdt|tdt|tddS)N?{Gz?皙?@??4@i@@)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rr)rrUUUUUU?)rrr)	rrrrrrr!r"r )Nr0r0r1_tests r__main__)Jrwarningsrr_typesrrrrZmathrrqrrrrrrr	rpr
rrrrrr
rosrr;_collections_abcrrnrroZhashlibrrE__all__ryrrrrrZ_randomrr(rrZ_instrrrr rrrrrrrrrrr!r"r#r$r%r&r'rr0r0r0r1<module>%sd("		
F!