Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325
 lŽŒY_gã@s|dZddlmZddlmZmZddl m Z m Z mZmZmZddl mZmZmZmZddlmZddlm Z!m"Z#ddl$m%Z&d d d d d ddddddddddddddddddgZ'd e d! ƒed"ƒZ(d"eZ)e d#ƒZ*d$e d%ƒZ+d&Z,d'e, Z-dd(l.Z.Gd)d „d e.j/ƒZ/Gd*d„de/ƒZ0d+d,„Z1d-d.d/„Z2e/ƒZ3e3j4Z4e3j5Z5e3j6Z6e3j7Z7e3j8Z8e3j9Z9e3j:Z:e3j;Z;e3j<Z<e3j=Z=e3j>Z>e3j?Z?e3j@Z@e3jAZAe3jBZBe3jCZCe3jDZDe3jEZEe3jFZFe3jGZGe3jHZHeId0krxe2ƒd(S)1a‰Random 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)Ú MethodTypeÚBuiltinMethodType)ÚlogÚexpÚpiÚeÚceil)ÚsqrtÚacosÚcosÚsin)Úurandom)ÚSetÚSequence)Úsha512ÚRandomÚseedÚrandomÚuniformÚrandintÚchoiceÚsampleÚ randrangeÚshuffleÚ normalvariateÚlognormvariateÚ expovariateÚvonmisesvariateÚ gammavariateÚ triangularÚgaussÚ betavariateÚ paretovariateÚweibullvariateÚgetstateÚsetstateÚ getrandbitsÚ SystemRandomégà?g@g@gð?g@é5éNcseZdZdZdZddd„Zdd‡fdd†Z‡fd d †Z‡fd d †Zd d„Z dd„Z dd„Z dde dd„Z dd„Ze de>eeedd„Zdd„Zddd„Zdd„Zd d!„Zd"d#dd$d%„Zd&d'„Zd(d)„Zd*d+„Zd,d-„Zd.d/„Zd0d1„Zd2d3„Zd4d5„Z d6d7„Z!‡S)8raã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|j|ƒd|_dS)zeInitialize an instance. Optional argument x controls seeding, as for Random.seed(). N)rÚ gauss_next)ÚselfÚx©r0ú%/opt/python35/lib/python3.5/random.pyÚ__init__Ts zRandom.__init__r+c su|dkr_ytjtdƒdƒ}Wn4tk r^ddl}t|jƒdƒ}YnX|dkrñt|ttfƒrñ|ršt|dƒd>nd}x&|D]}d|t|ƒAd @}q§W|t |ƒN}|d krëd n|}|d krXt|ttt fƒrXt|tƒr0|j ƒ}|t |ƒj ƒ7}tj|dƒ}tƒj|ƒ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Ä ÚbigréééiCBlÿÿÿÿr+éÿÿÿÿéþÿÿÿ)ÚintÚ from_bytesÚ_urandomÚNotImplementedErrorÚtimeÚ isinstanceÚstrÚbytesÚordÚlenÚ bytearrayÚencodeÚ_sha512ÚdigestÚsuperrr-)r.ÚaÚversionr=r/Úc)Ú __class__r0r1r]s(   !    z Random.seedcs|jtƒjƒ|jfS)z9Return internal state; can be passed to setstate() later.)ÚVERSIONrGr%r-)r.)rKr0r1r%†szRandom.getstatecs×|d}|dkr;|\}}|_tƒj|ƒn˜|dkrº|\}}|_ytdd„|Dƒƒ}Wn.tk r¦}zt|‚WYdd}~XnXtƒj|ƒntd||jfƒ‚dS)z:Restore internal state from object returned by getstate().rr,r+css|]}|dVqdS)r+é Nlr0)Ú.0r/r0r0r1ú —sz"Random.setstate..Nz?state with version %s passed to Random.setstate() of version %s)r-rGr&ÚtupleÚ ValueErrorÚ TypeErrorrL)r.ÚstaterIÚ internalstater)rKr0r1r&Šs   zRandom.setstatecCs |jƒS)N)r%)r.r0r0r1Ú __getstate__¨szRandom.__getstate__cCs|j|ƒdS)N)r&)r.rSr0r0r1Ú __setstate__«szRandom.__setstate__cCs|jf|jƒfS)N)rKr%)r.r0r0r1Ú __reduce__®szRandom.__reduce__r5c Csp||ƒ}||kr$tdƒ‚|dkrU|dkrI|j|ƒStdƒ‚||ƒ}||krytdƒ‚||}|dkr¬|dkr¬||j|ƒS|dkrÑtd|||fƒ‚||ƒ}||krõtdƒ‚|dkr||d|} n-|dkr7||d|} n td ƒ‚| dkr[tdƒ‚|||j| ƒ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()r5z'empty range for randrange() (%d,%d, %d)z non-integer step for randrange()zzero step for randrange())rQÚ _randbelow) r.ÚstartÚstopÚstepÚ_intÚistartÚistopÚwidthÚistepÚnr0r0r1r³s4                    zRandom.randrangecCs|j||dƒS)zJReturn random integer in range [a, b], including both end points. r5)r)r.rHÚbr0r0r1rßszRandom.randintc Csç|j}|j}||ƒ|ks6||ƒ|krq|jƒ} || ƒ} x| |krl|| ƒ} qQW| S||kr˜tdƒ||ƒ|ƒS||} || |} |ƒ} x| | krÔ|ƒ} q¼W|| |ƒ|S)zCReturn a random int in the range [0,n). Raises ValueError if n==0.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.)rr'Ú bit_lengthÚ_warn) r.rar9ÚmaxsizeÚtypeÚMethodÚ BuiltinMethodrr'ÚkÚrÚremÚlimitr0r0r1rXås"  $       zRandom._randbelowc CsBy|jt|ƒƒ}Wntk r9tdƒ‚YnX||S)z2Choose a random element from a non-empty sequence.z$Cannot choose from an empty sequence)rXrBrQÚ IndexError)r.ÚseqÚir0r0r1rs  z Random.choicecCsÏ|dkrk|j}x³ttdt|ƒƒƒD]3}||dƒ}||||||<||Population must be a sequence or set. For dicts, use list(d).rzSample larger than populationNéér)r,r5)r>Ú_SetrPÚ _SequencerRrXrBrQÚ_ceilÚ_logÚlistrqÚsetÚadd) r.Ú populationrirrraÚresultÚsetsizeÚpoolrorsÚselectedÚ selected_addr0r0r1r!s6       !      z Random.samplecCs||||jƒS)zHGet a random number in the range [a, b) or [a, b] depending on rounding.)r)r.rHrbr0r0r1r_szRandom.uniformggð?c Cs’|jƒ}y(|dkr!dn||||}Wntk rL|SYnX||krzd|}d|}||}}|||||dS)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 Ngà?gð?)rÚZeroDivisionError)r.ÚlowÚhighÚmodeÚurJr0r0r1r 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_MAGICCONSTry)r.ÚmuÚsigmarÚu1Úu2ÚzÚzzr0r0r1r{s   zRandom.normalvariatecCst|j||ƒƒ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)r.r‰rŠr0r0r1r”szRandom.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ð?)ryr)r.Úlambdr0r0r1r szRandom.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ð?)rÚTWOPIÚ_sqrtÚ_cosÚ_pir�Ú_acos)r.r‰ÚkapparÚsrjr‹r�ÚdrŒÚqÚfÚu3Úthetar0r0r1r³s&      .   zRandom.vonmisesvariatecCs|dks|dkr$tdƒ‚|j}|dkrtd|dƒ}|t}||}x™|ƒ}d|ko„dknsŒqdd|ƒ}t|d|ƒ|} |t| ƒ} |||} ||| | } | td| dks | t| ƒkrd| |SqdWnã|dkrZ|ƒ} x| dkrJ|ƒ} q2Wt| ƒ |Sx˜|ƒ} t|t}|| }|dkr›|d|} nt|||ƒ } |ƒ}|dkrÝ|| |dkrñPq]|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@gH¯¼šò×z>gËPÊÿÿï?g@N)rQrr’ÚLOG4ryr�Ú SG_MAGICCONSTÚ_e)r.ÚalphaÚbetarÚainvÚbbbÚcccr‹rŒÚvr/r�rjr‡rbÚpr0r0r1rãsJ       *        zRandom.gammavariatecCs€|j}|j}d|_|dkrt|ƒ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@gð?gÀ)rr-r‘r’ryr“Ú_sin)r.r‰rŠrr�Úx2piÚg2radr0r0r1r!+s     z Random.gausscCs>|j|dƒ}|dkr"dS|||j|dƒSdS)z�Beta distribution. Conditions on the parameters are alpha > 0 and beta > 0. Returned values range between 0 and 1. gð?rgN)r)r.r r¡Úyr0r0r1r"`s  zRandom.betavariatecCs d|jƒ}d|d|S)z3Pareto distribution. alpha is the shape parameter.gð?)r)r.r r‡r0r0r1r#rszRandom.paretovariatecCs'd|jƒ}|t|ƒ d|S)zfWeibull distribution. alpha is the scale parameter and beta is the shape parameter. gð?)rry)r.r r¡r‡r0r0r1r${szRandom.weibullvariate)"Ú__name__Ú __module__Ú __qualname__Ú__doc__rLr2rr%r&rUrVrWr9rrÚBPFrfÚ _MethodTypeÚ_BuiltinMethodTyperXrrrrr rrrrrr!r"r#r$r0r0)rKr1rDs6  )   ,    >    0 H 5  c@sPeZdZdZdd„Zdd„Zdd„Zdd „ZeZZ d S) r(zÝ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). cCstjtdƒdƒd?tS)z3Get the next random number in the range [0.0, 1.0).r6r3r,)r9r:r;Ú RECIP_BPF)r.r0r0r1r�szSystemRandom.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 integerr6ér3)rQr9rRr:r;)r.riÚnumbytesr/r0r0r1r'”s   zSystemRandom.getrandbitscOsdS)z%sd("         ÿÿF!