Ζ
δή?:c       sΟ  d  Z  d k Z d k l Z l Z l Z l Z l Z d k l Z l	 Z	 l
 Z
 l Z l Z l Z l Z l Z e d  Z e d  Z d e i f d     YZ e d  Z d	   Z d
 e	 d  e d  Z e d d  d   Z d   Z d   Z d   Z d e
 Z e d d  d   Z e d  Z e d d  d   Z d e d  Z e d d  d   Z  e Z! d   Z" d    Z# d!   Z$ d"   Z% e e& d#  Z' d% d$  Z( d&   Z) e* d' j o e(   n d S((   sQ  Random variable generators.

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

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

Translated from anonymously contributed C/C++ source.

Multi-threading note: the random number generator used here is not
thread-safe; it is possible that two calls return the same random
value.  See whrandom.py for more info.
N(   s   randoms   uniforms   randints   choices	   randrange(   s   logs   exps   pis   es   sqrts   acoss   coss   sinc    sΉ   |  t j o d d d f Sn t |   }  t |  d  \ }  } t |  d  \ }  } t |  d  \ }  } | |  d p d } | |  d p d } | |  d p d } | | | f Sd S(   s   Turn a hashable value into three seed values for whrandom.seed().

	None or no argument returns (0, 0, 0), to seed from current time.

	i    i   i   N(   s   as   Nones   hashs   divmods   xs   ys   z(   s   as   xs   ys   zs5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   makeseed s     c    s,   t  |   \ } } } t i | | |  d S(   se   Seed the default generator from any hashable value.

	None or no argument seeds from current time.

	N(   s   makeseeds   as   xs   ys   zs   whrandoms   seed(   s   as   xs   ys   zs5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   seed/ s     s	   generatorc      s    d  Z  e d  Z e d  Z RS(   s   Random generator class.c    s   |  i |  d S(   s7   Constructor.  Seed from current time or hashable value.N(   s   selfs   seeds   a(   s   selfs   as5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   __init__; s     c    s2   t  |  \ } } } t i i |  | | |  d S(   s7   Seed the generator from current time or hashable value.N(   s   makeseeds   as   xs   ys   zs   whrandoms   seeds   self(   s   selfs   as   xs   ys   zs5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   seed? s     (   s   __doc__s   Nones   __init__s   seed(    s5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys	   generator8 s    c    s   t  |   Sd S(   s'   Return a new random generator instance.N(   s	   generators   a(   s   as5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   new_generatorD s     c    sA   t  |   } t | |  d j o t d |  | | f  n d  S(   Nf1e-07sB   computed value for %s deviates too much (computed %g, expected %g)(   s   evals   names   computeds   abss   expecteds
   ValueError(   s   names   expecteds   computeds5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   verifyK s    i   f0.5f2.0s   NV_MAGICCONSTf1.71552776992c    sj   xW d oO t    } t    } t | d | } | | d } | t |  j o Pn q W|  | | Sd  S(   Ni   f0.5f4.0(	   s   randoms   u1s   u2s   NV_MAGICCONSTs   zs   zzs   logs   mus   sigma(   s   mus   sigmas   u1s   u2s   zs   zzs5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   normalvariateV s     		
c    s   t  t |  |   Sd  S(   N(   s   exps   normalvariates   mus   sigma(   s   mus   sigmas5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   lognormvariatei s    c    s   |  | t   d t Sd  S(   Nf0.5(   s   means   arcs   randoms   pi(   s   means   arcs5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   cunifvariaten s    c    s:   t    } x | d j o t    } q Wt |  |  Sd  S(   Nf1e-07(   s   randoms   us   logs   lambd(   s   lambds   us5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   expovariatev s
    	 s   TWOPIf6.28318530718c    s?  | d j o t t   Sn d t d d | |  } | t d |  d | } d | | d | } x d o t   } t t	 |  } d | | | | } | | | } t   }	 |	 | d | j o |	 | t d |  j o Pn qm Wt   }
 |
 d j o |  t t |  } n |  t t |  } | Sd  S(   Nf1e-06f1.0f4.0f2.0i   f0.5(   s   kappas   TWOPIs   randoms   sqrts   as   bs   rs   u1s   coss   pis   zs   fs   cs   u2s   exps   u3s   mus   acoss   theta(   s   mus   kappas   as   bs   rs   u1s   zs   fs   cs   u2s   u3s   thetas5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   vonmisesvariate s&     		1
	f4.0s   LOG4f1.38629436112c    s7   t  d |  d  } | t |  | |  t |  |  Sd  S(   Nf2.0f1.0(   s   sqrts   alphas   ainvs   betas   stdgammas   LOG4(   s   alphas   betas   ainvs5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   gammavariate° s    f1.0f4.5s   SG_MAGICCONSTf2.50407739678c    sΣ  |  d j o t d  n |  d j o‘ x d o t   } t   } t | d |  | } |  t |  } | | | } | | | | }	 |	 t d | d j p |	 t |  j o | Sn q* Wn|  d j o6 t   }
 x |
 d j o t   }
 qα Wt |
  SnΕ x½ d o΅ t   }
 t |  t } | |
 } | d j o t | d |   } n t | | |   } t   } | d j o | t |  j p$ | d j o | t | |  d  j o Pn qW| Sd  S(   Nf0.0s   stdgamma: alpha must be > 0.0f1.0i   f4.5f1e-07(   s   alphas
   ValueErrors   randoms   u1s   u2s   logs   ainvs   vs   exps   xs   zs   bbbs   cccs   rs   SG_MAGICCONSTs   us   es   bs   ps   pow(   s   alphas   ainvs   bbbs   cccs   u1s   u2s   vs   xs   zs   rs   us   bs   ps5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   stdgammaΈ s>     		,	  	
	I
c    sx   t  } t a  | t j oO t   t } t d t d t     } t	 |  | } t
 |  | a  n |  | | Sd  S(   Nf2.0f1.0(   s
   gauss_nexts   zs   Nones   randoms   TWOPIs   x2pis   sqrts   logs   g2rads   coss   sins   mus   sigma(   s   mus   sigmas   zs   x2pis   g2rads5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   gaussξ s     c    s,   t  |   } t  d |  } | | | Sd  S(   Nf1.0(   s   expovariates   alphas   ys   betas   z(   s   alphas   betas   ys   zs5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   betavariates    c    s"   t    } d t | d |   Sd  S(   Nf1.0(   s   randoms   us   pows   alpha(   s   alphas   us5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   paretovariates    	c    s)   t    } |  t t |  d |  Sd  S(   Nf1.0(   s   randoms   us   alphas   pows   logs   beta(   s   alphas   betas   us5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   weibullvariate"s    	c    sg   x` t  t |   d d d  d r? } | |   | d  } |  | |  | f \ |  | <|  | <q  Wd S(   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.
    i   i    N(   s   xranges   lens   xs   is   ints   randoms   j(   s   xs   randoms   ints   is   js5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   shuffle,s
    
   c    sψ   d Gt  GHd Gt GHd Gt GHd Gt GHt |  d  t |  d  t |  d  t |  d  t |  d	  t |  d
  t |  d  t |  d  t |  d  t |  d  t |  d  t |  d  t |  d  t |  d  t |  d  t |  d  d  S(   Ns   TWOPI         =s   LOG4          =s   NV_MAGICCONST =s   SG_MAGICCONST =s   random()s   normalvariate(0.0, 1.0)s   lognormvariate(0.0, 1.0)s   cunifvariate(0.0, 1.0)s   expovariate(1.0)s   vonmisesvariate(0.0, 1.0)s   gammavariate(0.5, 1.0)s   gammavariate(0.9, 1.0)s   gammavariate(1.0, 1.0)s   gammavariate(2.0, 1.0)s   gammavariate(20.0, 1.0)s   gammavariate(200.0, 1.0)s   gauss(0.0, 1.0)s   betavariate(3.0, 3.0)s   paretovariate(1.0)s   weibullvariate(1.0, 1.0)(   s   TWOPIs   LOG4s   NV_MAGICCONSTs   SG_MAGICCONSTs   test_generators   N(   s   Ns5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   test?s(    				iΘ   c    s  d  k  } |  Gd G| GHt | | d  } d } d } d } d } | i    } xX t
 |   d rH }	 t |  }
 | |
 } | |
 |
 } t |
 |  } t |
 |  } q\ W| i    } t | | d  Gd G| |  } t | |  | |  } d | | | | f GHd  S(	   Ns   timess   evalf0.0f10000000000.0i    i   s   sec,s!   avg %g, stddev %g, min %g, max %g(   s   times   ns   funccalls   compiles   codes   sums   sqsums   smallests   largests   t0s   ranges   is   evals   xs   mins   maxs   t1s   rounds   avgs   sqrts   stddev(   s   ns   funccalls   times   codes   sums   sqsums   smallests   largests   t0s   is   xs   t1s   avgs   stddevs5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   test_generatorUs(    	 

s   __main__(+   s   __doc__s   whrandoms   randoms   uniforms   randints   choices	   randranges   maths   logs   exps   pis   es   sqrts   acoss   coss   sins   Nones   makeseeds   seeds	   generators   new_generators   verifys   NV_MAGICCONSTs   normalvariates   lognormvariates   cunifvariates   expovariates   TWOPIs   vonmisesvariates   LOG4s   gammavariates   SG_MAGICCONSTs   stdgammas
   gauss_nexts   gausss   betavariates   paretovariates   weibullvariates   ints   shuffles   tests   test_generators   __name__(    s5   /home/guest/edwardam/cmp2/py2/lib/python2.0/random.pys   ? sB   	%7							
	)		5	"	
		
	