‡Æ
ùMö9c       s8    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 8 d e i f d „  ƒ  YZ D e d „ Z K d	 „  Z T d
 e	 d ƒ e d ƒ Z U e d d ƒ V d „  Z i d „  Z n d „  Z v 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( Ud& „  Z) ke* d' j o l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   zs#   /mit/python/lib/python2.0/random.pys   makeseed s   c    s8   / 4 5 t  |  ƒ \ } } } 6 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   zs#   /mit/python/lib/python2.0/random.pys   seed/ s   s	   generatorc      s,   8 d  Z  9 ; 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   as#   /mit/python/lib/python2.0/random.pys   __init__; s   c    s>   ? @ A t  | ƒ \ } } } B 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   zs#   /mit/python/lib/python2.0/random.pys   seed? s   (   s   __doc__s   Nones   __init__s   seed(    s#   /mit/python/lib/python2.0/random.pys	   generator8 s   	c    s   D E F t  |  ƒ Sd S(   s'   Return a new random generator instance.N(   s	   generators   a(   s   as#   /mit/python/lib/python2.0/random.pys   new_generatorD s   c    sM   K L t  |  ƒ } M t | | ƒ d j o N 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   computeds#   /mit/python/lib/python2.0/random.pys   verifyK s   i   f0.5f2.0s   NV_MAGICCONSTf1.71552776992c    sˆ   V ^ xl ^ d oa _ t  ƒ  } ` t  ƒ  } a t | d | } b | | d } c | t | ƒ j o d Pn q	 We |  | | 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   zzs#   /mit/python/lib/python2.0/random.pys   normalvariateV s    
c    s   i j t  t |  | ƒ ƒ Sd  S(   N(   s   exps   normalvariates   mus   sigma(   s   mus   sigmas#   /mit/python/lib/python2.0/random.pys   lognormvariatei s   c    s!   n r |  | t ƒ  d t Sd  S(   Nf0.5(   s   means   arcs   randoms   pi(   s   means   arcs#   /mit/python/lib/python2.0/random.pys   cunifvariaten s   c    sL   v z t  ƒ  } { x! { | d j o | t  ƒ  } q W} t | ƒ |  Sd  S(   Nf1e-07(   s   randoms   us   logs   lambd(   s   lambds   us#   /mit/python/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 q‚ W£ t ƒ  }
 ¤ |
 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   thetas#   /mit/python/lib/python2.0/random.pys   vonmisesvariate„ s&    
4f4.0s   LOG4f1.38629436112c    s@   ° ² t  d |  d ƒ } ³ | t |  | |  t |  | ƒ Sd  S(   Nf2.0f1.0(   s   sqrts   alphas   ainvs   betas   stdgammas   LOG4(   s   alphas   betas   ainvs#   /mit/python/lib/python2.0/random.pys   gammavariate° s   f1.0f4.5s   SG_MAGICCONSTf2.50407739678c    s3  ¸ ½ |  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 q9 Wn>Ð |  d j oE Ò t ƒ  }
 Ó x! Ó |
 d j o Ô t ƒ  }
 qWÕ t |
 ƒ 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 qM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   ps#   /mit/python/lib/python2.0/random.pys   stdgamma¸ s>    
/  
Lc    s–   î t  } t a  | t j o[ 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   g2rads#   /mit/python/lib/python2.0/random.pys   gaussî s   		!c    s8   t  |  ƒ } t  d | ƒ } | | | Sd  S(   Nf1.0(   s   expovariates   alphas   ys   betas   z(   s   alphas   betas   ys   zs#   /mit/python/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   us#   /mit/python/lib/python2.0/random.pys   paretovariates   c    s2   "%t  ƒ  } &|  t t | ƒ d | ƒ Sd  S(   Nf1.0(   s   randoms   us   alphas   pows   logs   beta(   s   alphas   betas   us#   /mit/python/lib/python2.0/random.pys   weibullvariate"s   c    sy   ,68xi t  t |  ƒ d d d ƒ d 8rE } :| | ƒ  | 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   js#   /mit/python/lib/python2.0/random.pys   shuffle,s
   
# 	c    s7  ?@d Gt  GHAd Gt GHBd Gt GHCd Gt GHDt |  d ƒ Et |  d ƒ Ft |  d ƒ Gt |  d ƒ Ht |  d	 ƒ It |  d
 ƒ Jt |  d ƒ Kt |  d ƒ Lt |  d ƒ Mt |  d ƒ Nt |  d ƒ Ot |  d ƒ Pt |  d ƒ Qt |  d ƒ Rt |  d ƒ S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   Ns#   /mit/python/lib/python2.0/random.pys   test?s(   iÈ   c    sC  UVd  k  } W|  Gd G| GHXt | | d ƒ } Yd } Zd } [d } \d } ]| i  ƒ  } ^xj t
 |  ƒ d ^rW }	 _t | ƒ }
 `| |
 } a| |
 |
 } bt |
 | ƒ } ct |
 | ƒ } qz Wd| i  ƒ  } et | | d ƒ Gd Gf| |  } gt | |  | | ƒ } h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   stddevs#   /mit/python/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__(    s#   /mit/python/lib/python2.0/random.pys   ? sB   (:		)5	"

