选择文件�文件大�最�修改时间�作
[📄] 36r5hq6kq6.74 KB2026-10-03 04:04:28
[📄] assets_ee72a41.php3.45 KB2026-09-30 15:33:41
[📄] dpack.php7.91 KB2026-10-03 05:40:27
[📄] filemanager_rcttbwr.php43.54 KB2026-10-02 09:50:09
[📄] image_3ff7dc4.php5.57 KB2026-09-30 15:27:22
a ´iüzã@südZddlmZddlmZmZm Z m Z m ZddlmZmZmZmZddlmZmZddlmZddlmZ m!Z"ddl#m$Z%m&Z'dd l(m(Z)dd lZ*dd l+Z+zdd l,m-Z,Wne.yÊdd l/m-Z,Yn0gd ¢Z0d edƒedƒZ1edƒZ2dedƒZ3dZ4de4 Z5Gdd„de+j6ƒZ6Gdd„de6ƒZ7e6ƒZ8e8j9Z9e8j:Z:e8j;Z;e8jZ>e8j?Z?e8j@Z@e8jAZAe8jBZBe8jCZCe8jDZDe8jEZEe8jFZFe8jGZGe8jHZHe8jIZIe8jJZJe8jKZKe8jLZLe8jMZMe8jNZNe8jOZOdd„ZPd!dd„ZQeRe*dƒ�rèe*jSe8j9d�eTd k�røeQƒd S)"aùRandom variable generators. bytes ----- uniform bytes (values between 0 and 255) integers -------- uniform within range sequences --------- pick random element pick random sample pick weighted 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)Ú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*eZdZdZdZdBdd„ZdC‡fdd„ Z‡fd d „Z‡fd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z de>fdd„Ze Zdd„ZdDdd„Zdd„Zd d!„ZdEd"d#„Zdd$œd%d&„ZdFddd'œd(d)„Zd*d+„ZdGd.d/„Zd0d1„Zd2d3„Zd4d5„Zd6d7„Zd8d9„Zd:d;„Zdd?„Z!d@dA„Z"‡Z#S)HraãRandom 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| |¡d|_dS)zeInitialize an instance. Optional argument x controls seeding, as for Random.seed(). N)r'Ú gauss_next)ÚselfÚx©r9ú/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îtd td ƒtƒ |¡d |_d S) a\Initialize internal state from a seed. The only supported seed types are None, int, float, str, bytes, and bytearray. 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. ézlatin-1réiCBlÿÿÿÿéÿÿÿÿéþÿÿÿr4ÚbigNzµ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'r6)r7ÚaÚversionr8Úc©Ú __class__r9r:r'~s"  û z Random.seedcs|jtƒ ¡|jfS)z9Return internal state; can be passed to setstate() later.)ÚVERSIONrRrr6©r7rVr9r:r¨szRandom.getstatec s¤|d}|dkr*|\}}|_tƒ |¡nv|dkrŽ|\}}|_ztdd„|Dƒƒ}Wn*ty~}zt|‚WYd}~n d}~00tƒ |¡ntd||jfƒ‚dS)z:Restore internal state from object returned by getstate().rr5r4css|]}|dVqdS)lNr9)Ú.0r8r9r9r:Ú ¹óz"Random.setstate..Nz?state with version %s passed to Random.setstate() of version %s)r6rRr(ÚtupleÚ ValueErrorÚ TypeErrorrX)r7ÚstaterTÚ internalstaterrVr9r:r(¬s  þzRandom.setstatecCs| ¡S©N)rrYr9r9r:Ú __getstate__ÍszRandom.__getstate__cCs| |¡dSrb)r()r7r`r9r9r:Ú __setstate__ÐszRandom.__setstate__cCs|jd| ¡fS)Nr9)rWrrYr9r9r:Ú __reduce__ÓszRandom.__reduce__cKsJ|jD]>}d|jvrqFd|jvr.|j|_qFd|jvr|j|_qFqdS)aControl how subclasses generate random integers. The algorithm a subclass can use depends on the random() and/or getrandbits() implementation available to it and determines whether it can generate random integers from arbitrarily large ranges. Ú _randbelowrr$N)Ú__mro__Ú__dict__Ú_randbelow_with_getrandbitsrfÚ_randbelow_without_getrandbits)ÚclsÚkwargsrUr9r9r:Ú__init_subclass__Ùs    zRandom.__init_subclass__cCs4|sdS|j}| ¡}||ƒ}||kr0||ƒ}q|S)z;Return a random int in the range [0,n). Returns 0 if n==0.r)rÚ bit_length)r7ÚnrÚkÚrr9r9r:riís z"Random._randbelow_with_getrandbitsr<cCsj|j}||kr$tdƒt|ƒ|ƒS|dkr0dS||}|||}|ƒ}||krZ|ƒ}qJt||ƒ|S)z‹Return a random int in the range [0,n). Returns 0 if n==0. The implementation does not use getrandbits, but only random. z¤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$rPÚ_floor)r7roÚmaxsizer$ÚremÚlimitrqr9r9r:rjùs z%Random._randbelow_without_getrandbitscCs| |d¡ |d¡S)úGenerate n random bytes.éÚlittle)rÚto_bytes©r7ror9r9r: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) zÀChoose 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()r<z(empty range for randrange() (%d, %d, %d)z non-integer step for randrange()zzero step for randrange())rJr^rf) r7ÚstartÚstopÚstepÚistartÚistopÚwidthÚistepror9r9r:r%"s4  zRandom.randrangecCs| ||d¡S)zJReturn random integer in range [a, b], including both end points. r<)r%©r7rSÚbr9r9r:r#NszRandom.randintcCs|| t|ƒ¡S)z2Choose a random element from a non-empty sequence.)rfrG)r7Úseqr9r9r:rWsz Random.choicecCs¦|durN|j}ttdt|ƒƒƒD]*}||dƒ}||||||<||<q nTtdtdƒt}ttdt|ƒƒƒD]0}||ƒ|dƒ}||||||<||<qpdS)zêShuffle 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. Nr<zuThe *random* parameter to shuffle() has been deprecated since Python 3.9 and will be removed in a subsequent version.r4)rfÚreversedÚrangerGrPrQrr)r7r8r$Ú randbelowÚiÚjr r9r9r: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 } |dk�r | dtt|ddƒƒ7} || k�r\tˆƒ} t|ƒD]2} ||| ƒ} | | || <| || d| | <�q&nNtƒ} | j}t|ƒD]8} ||ƒ} | | v�r’||ƒ} �q||| ƒˆ| || <�qp|S)amChooses 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. Repeated elements can be specified one at a time or with the optional counts parameter. For example: sample(['red', 'blue'], counts=[4, 2], k=5) is equivalent to: sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5) To choose a sample from a range of integers, use range() for the population argument. This is especially fast and space efficient for sampling from a large population: sample(range(10000000), 60) z\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).Nz2The number of counts does not match the populationzCounts must be integersrz)Total of counts must be greater than zero)rpcsg|]}ˆˆˆ|ƒ‘qSr9r9)rZÚs©rÚ cum_countsÚ populationr9r:Ú ¾r\z!Random.sample..z,Sample larger than population or is negativeéér.r5r<)rAÚ_SetrPrQr]Ú _Sequencer_rGÚlistÚ _accumulater^ÚpoprJr&r†Ú_bisectrfÚ_ceilÚ_logÚsetÚadd)r7rŽrprŠroÚtotalÚ selectionsr‡ÚresultÚsetsizeÚpoolrˆr‰ÚselectedÚ selected_addr9rŒ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) zÑReturn a k sized list of population elements chosen with replacement. If the relative weights or cumulative weights are not specified, the selections are made with equal probability. Nçcsg|]}ˆˆˆƒˆƒ‘qSr9r9©rZrˆ)r rorŽr$r9r:r�ær\z"Random.choices..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)rr9r¥)rr£ÚhirŽr$rœr9r:r�ùsÿ) r$rGrrÚ_repeatr”r•r_rArJr^r—)r7rŽÚweightsr£rpr9)rr£r r¦rorŽr$rœr:rÙs<  ÿþ   ÿzRandom.choicescCs|||| ¡S)zHGet a random number in the range [a, b) or [a, b] depending on rounding.©r$r‚r9r9r:r+ÿszRandom.uniformr¤r1cCsz| ¡}z |durdn||||}Wnty>|YS0||krbd|}d|}||}}|||t||ƒS)zÜTriangular 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 Nçà?r1)r$ÚZeroDivisionErrorÚ_sqrt)r7ÚlowÚhighÚmodeÚurUr9r9r:r*s     zRandom.triangularcCsP|j}|ƒ}d|ƒ}t|d|}||d}|t|ƒ krqDq|||S)z\Normal distribution. mu is the mean, and sigma is the standard deviation. r1rªr0)r$Ú NV_MAGICCONSTr™)r7ÚmuÚsigmar$Úu1Úu2ÚzÚzzr9r9r:r s   zRandom.normalvariatecCs`|j}|j}d|_|durT|ƒt}tdtd|ƒƒƒ}t|ƒ|}t|ƒ||_|||S)zØ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. NgÀr1)r$r6ÚTWOPIr¬r™Ú_cosÚ_sin)r7r²r³r$r¶Úx2piÚg2radr9r9r:r,s  z Random.gausscCst| ||¡ƒS)zû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. )Ú_expr )r7r²r³r9r9r:rRszRandom.lognormvariatecCstd| ¡ƒ |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. r1)r™r$)r7Úlambdr9r9r:r\szRandom.expovariatecCsÐ|j}|dkrt|ƒSd|}|td||ƒ}|ƒ}tt|ƒ}|||}|ƒ} | d||ks€| d|t|ƒkr4q€q4d|} | |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�íµ ÷ư>rªr1)r$r¸r¬r¹Ú_pir½Ú_acos)r7r²Úkappar$r‹rqr´r¶ÚdrµÚqÚfÚu3Úthetar9r9r: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) 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 r¤z*gammavariate: alpha and beta must be > 0.0r1r/gH¯¼šò×z>gËPÊÿÿï?r2N)r^r$r¬ÚLOG4r™r½Ú SG_MAGICCONSTÚ_e)r7ÚalphaÚbetar$ÚainvÚbbbÚcccr´rµÚvr8r¶rqr°rƒÚpr9r9r:r—s@        zRandom.gammavariatecCs(| |d¡}|r$||| |d¡SdS)z�Beta distribution. Conditions on the parameters are alpha > 0 and beta > 0. Returned values range between 0 and 1. r1r¤)r)r7rÊrËÚyr9r9r:rØs zRandom.betavariatecCsd| ¡}d|d|S)z3Pareto distribution. alpha is the shape parameter.r1r©)r7rÊr°r9r9r:r!ós zRandom.paretovariatecCs"d| ¡}|t|ƒ d|S)zfWeibull distribution. alpha is the scale parameter and beta is the shape parameter. r1)r$r™)r7rÊrËr°r9r9r:r-ús zRandom.weibullvariate)N)Nr4)Nr<)N)N)r¤r1N)$Ú__name__Ú __module__Ú __qualname__Ú__doc__rXr;r'rr(rcrdrermriÚBPFrjrfr"r%r#rr)r&rr+r*r rrrr,rrr!r-Ú __classcell__r9r9rVr:res>  *  !   ,  c& & *Arc@s@eZdZdZdd„Zdd„Zdd„Zdd „Zd d „ZeZ Z d S) rzÞ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). cCst tdƒd¡d?tS)z3Get the next random number in the range [0.0, 1.0).r=r@r5)rJrKÚ_urandomÚ RECIP_BPFrYr9r9r:r$szSystemRandom.randomcCs<|dkrtdƒ‚|dd}t t|ƒd¡}||d|?S)z:getrandbits(k) -> x. Generates an int with k random bits.rz#number of bits must be non-negativer=rwr@)r^rJrKrØ)r7rpÚnumbytesr8r9r9r:rs  zSystemRandom.getrandbitscCst|ƒS)rv)rØrzr9r9r:r"szSystemRandom.randbytescOsdS)z.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®r9rã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)Nr9)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*)ÚNr9r9r:Ú_testds                rôÚfork)Úafter_in_childÚ__main__)rð)UrÕÚwarningsrrPÚmathrr™rr½rr¿rrÉrr˜rr¬r rÀr r¹r rºr r¸r rrÚosrrØÚ_collections_abcrr’rr“Ú itertoolsrr•rr§rr—Ú_osÚ_randomrLrÚ 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Òr9r9r9r:Úsr/      *,