ó
è¾bc           @   s£  d  Z  d d l m Z d d l m Z d d l m Z m	 Z
 d d l m Z m Z m Z m Z m Z d d l m Z m Z m Z m Z d d l m Z  d d l! m" Z# d d	 l$ Z% d
 d d d d d d d d d d d d d d d d d d d d d d  d! d" g Z& d# e d$ ƒ e d% ƒ Z' d% e Z( e d& ƒ Z) d' e d( ƒ Z* d) Z+ d* e+ Z, d d	 l- Z- d
 e- j. f d+ „  ƒ  YZ. d  e. f d, „  ƒ  YZ/ d" e. f d- „  ƒ  YZ0 d. „  Z1 d/ d0 „ Z2 e. ƒ  Z3 e3 j4 Z4 e3 j5 Z5 e3 j6 Z6 e3 j7 Z7 e3 j8 Z8 e3 j9 Z9 e3 j: Z: e3 j; Z; e3 j< Z< e3 j= Z= e3 j> Z> e3 j? Z? e3 j@ Z@ e3 jA ZA e3 jB ZB e3 jC ZC e3 jD ZD e3 jE ZE e3 jF ZF e3 jG ZG e3 jH ZH e3 jI ZI eJ d1 k rŸe2 ƒ  n  d	 S(2   sP  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.
* Without a direct way to compute N steps forward, the semantics of
  jumpahead(n) are weakened to simply jump to another distant state and rely
  on the large period to avoid overlapping sequences.
* The random() method is implemented in C, executes in a single Python step,
  and is, therefore, threadsafe.

iÿÿÿÿ(   t   division(   t   warn(   t
   MethodTypet   BuiltinMethodType(   t   logt   expt   pit   et   ceil(   t   sqrtt   acost   cost   sin(   t   urandom(   t   hexlifyNt   Randomt   seedt   randomt   uniformt   randintt   choicet   samplet	   randranget   shufflet   normalvariatet   lognormvariatet   expovariatet   vonmisesvariatet   gammavariatet
   triangulart   gausst   betavariatet   paretovariatet   weibullvariatet   getstatet   setstatet	   jumpaheadt   WichmannHillt   getrandbitst   SystemRandomi   g      à¿g       @g      @g      ð?g      @i5   i   c           B   s*  e  Z d  Z d Z d d „ Z d d „ Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d	 „  Z d d
 e d e >d „ Z d „  Z e e d e >e e d „ Z d „  Z d d „ Z d „  Z d „  Z d d d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z  d „  Z! d „  Z" RS(    sÎ  Random number generator base class used by bound module functions.

    Used to instantiate instances of Random to get generators that don't
    share state.  Especially useful for multi-threaded programs, creating
    a different instance of Random for each thread, and using the jumpahead()
    method to ensure that the generated sequences seen by each thread don't
    overlap.

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

    i   c         C   s   |  j  | ƒ d |  _ d S(   se   Initialize an instance.

        Optional argument x controls seeding, as for Random.seed().
        N(   R   t   Nonet
   gauss_next(   t   selft   x(    (    s   /usr/lib/python2.7/random.pyt   __init__[   s    c         C   s‡   | d k rd y t t t d ƒ ƒ d ƒ } Wqd t k
 r` d d l } t | j ƒ  d ƒ } qd Xn  t t |  ƒ j | ƒ d |  _	 d S(   s†  Initialize internal state of the random number generator.

        None or no argument seeds from current time or from an operating
        system specific randomness source if available.

        If a is not None or is an int or long, hash(a) is used instead.
        Hash values for some types are nondeterministic when the
        PYTHONHASHSEED environment variable is enabled.
        iÄ	  i   iÿÿÿÿNi   (
   R(   t   longt   _hexlifyt   _urandomt   NotImplementedErrort   timet   superR   R   R)   (   R*   t   aR1   (    (    s   /usr/lib/python2.7/random.pyR   d   s    c         C   s"   |  j  t t |  ƒ j ƒ  |  j f S(   s9   Return internal state; can be passed to setstate() later.(   t   VERSIONR2   R   R"   R)   (   R*   (    (    s   /usr/lib/python2.7/random.pyR"   {   s    c         C   sÎ   | d } | d k rA | \ } } |  _  t t |  ƒ j | ƒ n‰ | d k r± | \ } } |  _  y t d „  | Dƒ ƒ } Wn t k
 r— } t | ‚ n Xt t |  ƒ j | ƒ n t d | |  j f ƒ ‚ d S(   s:   Restore internal state from object returned by getstate().i    i   i   c         s   s   |  ] } t  | ƒ d Vq d S(   i   i    NI       (   R-   (   t   .0R+   (    (    s   /usr/lib/python2.7/random.pys	   <genexpr>Œ   s    s?   state with version %s passed to Random.setstate() of version %sN(   R)   R2   R   R#   t   tuplet
   ValueErrort	   TypeErrorR4   (   R*   t   statet   versiont   internalstateR   (    (    s   /usr/lib/python2.7/random.pyR#      s    
c         C   sW   t  | ƒ t  |  j ƒ  ƒ } t t j d | ƒ j ƒ  d ƒ } t t |  ƒ j | ƒ d S(   s®   Change the internal state to one that is likely far away
        from the current state.  This method will not be in Py3.x,
        so it is better to simply reseed.
        t   sha512i   N(	   t   reprR"   t   intt   _hashlibt   newt	   hexdigestR2   R   R$   (   R*   t   nt   s(    (    s   /usr/lib/python2.7/random.pyR$   •   s    !c         C   s
   |  j  ƒ  S(   N(   R"   (   R*   (    (    s   /usr/lib/python2.7/random.pyt   __getstate__¦   s    c         C   s   |  j  | ƒ d  S(   N(   R#   (   R*   R9   (    (    s   /usr/lib/python2.7/random.pyt   __setstate__©   s    c         C   s   |  j  d |  j ƒ  f S(   N(    (   t	   __class__R"   (   R*   (    (    s   /usr/lib/python2.7/random.pyt
   __reduce__¬   s    i   l    c         C   så  | | ƒ } | | k r$ t  d ‚ n  | d	 k ru | d k ri | | k rU |  j | ƒ S| |  j ƒ  | ƒ St  d ‚ n  | | ƒ } | | k r™ t  d ‚ n  | | } | d k rü | d k rü | | k rÞ | | |  j | ƒ ƒ S| | | |  j ƒ  | ƒ ƒ S| d k r!t  d | | | f ‚ n  | | ƒ }	 |	 | k rEt  d ‚ n  |	 d k rf| |	 d |	 }
 n* |	 d k  r‡| |	 d |	 }
 n	 t  d ‚ |
 d k r¨t  d ‚ n  |
 | k rÉ| |	 |  j |
 ƒ S| |	 | |  j ƒ  |
 ƒ S(
   sÀ   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.

        s!   non-integer arg 1 for randrange()i    s   empty range for randrange()s    non-integer stop for randrange()i   s'   empty range for randrange() (%d,%d, %d)s    non-integer step for randrange()s   zero step for randrange()N(   R7   R(   t
   _randbelowR   (   R*   t   startt   stopt   stept   _intt	   _maxwidtht   istartt   istopt   widtht   istepRB   (    (    s   /usr/lib/python2.7/random.pyR   ±   s@    

	c         C   s   |  j  | | d ƒ S(   sJ   Return random integer in range [a, b], including both end points.
        i   (   R   (   R*   R3   t   b(    (    s   /usr/lib/python2.7/random.pyR   ð   s    c   
      C   sÁ   y |  j  } Wn t k
 r  nt Xt |  j ƒ | k sH t | ƒ | k r” | d | | d d ƒ ƒ } | | ƒ }	 x |	 | k r | | ƒ }	 qt W|	 S| | k r­ t d ƒ n  | |  j ƒ  | ƒ S(   s£   Return a random int in the range [0,n)

        Handles the case where n has more bits than returned
        by a single call to the underlying generator.
        grÄZ|
 ð?i   g       @sg   Underlying random() generator does not supply 
enough bits to choose from a population range this large(   R&   t   AttributeErrort   typeR   t   _warn(
   R*   RB   t   _logRL   RM   t   _Methodt   _BuiltinMethodR&   t   kt   r(    (    s   /usr/lib/python2.7/random.pyRH   ö   s    'c         C   s   | t  |  j ƒ  t | ƒ ƒ S(   s2   Choose a random element from a non-empty sequence.(   R>   R   t   len(   R*   t   seq(    (    s   /usr/lib/python2.7/random.pyR     s    c         C   s|   | d k r |  j } n  t } xW t t d t | ƒ ƒ ƒ D]: } | | ƒ  | d ƒ } | | | | | | <| | <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.

        i   N(   R(   R   R>   t   reversedt   xrangeR[   (   R*   R+   R   RL   t   it   j(    (    s   /usr/lib/python2.7/random.pyR     s    "c         C   sÉ  t  | ƒ } d | k o# | k n s7 t d ƒ ‚ n  |  j } t } d	 g | } d } | d k r‰ | d t t | d d ƒ ƒ 7} n  | | k s¤ t | d ƒ rt | ƒ } xt	 | ƒ D]A }	 | | ƒ  | |	 ƒ }
 | |
 | |	 <| | |	 d | |
 <q½ WnÀ y~ t
 ƒ  } | j } xe t	 | ƒ D]W }	 | | ƒ  | ƒ }
 x# |
 | k re| | ƒ  | ƒ }
 qCW| |
 ƒ | |
 | |	 <q'WWn? t t f k
 rÄt | t ƒ r®‚  n  |  j t | ƒ | ƒ SX| S(
   s8  Chooses k unique random elements from a population sequence.

        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 xrange as an argument.
        This is especially fast and space efficient for sampling from a
        large population:   sample(xrange(10000000), 60)
        i    s   sample larger than populationi   i   i   i   t   keysi   N(   R[   R7   R   R>   R(   t   _ceilRV   t   hasattrt   listR^   t   sett   addR8   t   KeyErrort
   isinstanceR   R6   (   R*   t
   populationRY   RB   R   RL   t   resultt   setsizet   poolR_   R`   t   selectedt   selected_add(    (    s   /usr/lib/python2.7/random.pyR   '  s:    	$		
c         C   s   | | | |  j  ƒ  S(   sH   Get a random number in the range [a, b) or [a, b] depending on rounding.(   R   (   R*   R3   RR   (    (    s   /usr/lib/python2.7/random.pyR   h  s    g        g      ð?c         C   s‘   |  j  ƒ  } y( | d k r! d n | | | | } Wn t k
 rH | SX| | k ry d | } d | } | | } } n  | | | | | d S(   sÜ   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

        g      à?g      ð?N(   R   R(   t   ZeroDivisionError(   R*   t   lowt   hight   modet   ut   c(    (    s   /usr/lib/python2.7/random.pyR   n  s    	(

c         C   si   |  j  } xQ | ƒ  } d | ƒ  } t | d | } | | d } | t | ƒ k r Pq q W| | | S(   s\   Normal distribution.

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

        g      ð?g      à?g      @(   R   t   NV_MAGICCONSTRV   (   R*   t   mut   sigmaR   t   u1t   u2t   zt   zz(    (    s   /usr/lib/python2.7/random.pyR   „  s    		c         C   s   t  |  j | | ƒ ƒ S(   sû   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.

        (   t   _expR   (   R*   Rv   Rw   (    (    s   /usr/lib/python2.7/random.pyR     s    c         C   s   t  d |  j ƒ  ƒ | S(   s^  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      ð?(   RV   R   (   R*   t   lambd(    (    s   /usr/lib/python2.7/random.pyR   ©  s    c         C   s  |  j  } | d k r  t | ƒ  Sd | } | t d | | ƒ } xf | ƒ  } t t | ƒ } | | | } | ƒ  }	 |	 d | | k  s£ |	 d | t | ƒ k rE PqE qE Wd | }
 |
 | d |
 | } | ƒ  } | d k r÷ | t | ƒ t } n | t | ƒ t } | S(   sF  Circular 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   t   TWOPIt   _sqrtt   _cost   _piR|   t   _acos(   R*   Rv   t   kappaR   RC   RZ   Rx   Rz   t   dRy   t   qt   ft   u3t   theta(    (    s   /usr/lib/python2.7/random.pyR   ¼  s&    	
		.
	c         C   s
  | d k s | d k r$ t  d ‚ n  |  j } | d k rt d | d ƒ } | t } | | } x¢| ƒ  } d | k  o„ d k  n s qd n  d | ƒ  } t | d | ƒ | }	 | t |	 ƒ }
 | | | } | | |	 |
 } | t d | d k s| t | ƒ k rd |
 | Sqd Wné | d k r]| ƒ  } x | d k rM| ƒ  } q5Wt | ƒ | Sxž | ƒ  } t | t } | | } | d k rž| d | }
 n t | | | ƒ }
 | ƒ  } | d k rã| |
 | d k rúPqúq`| t |
 ƒ k r`Pq`q`W|
 | Sd S(	   sZ  Gamma 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

        g        s*   gammavariate: alpha and beta must be > 0.0g      ð?g       @gH¯¼šò×z>gËPÊÿÿï?g      @N(   R7   R   R   t   LOG4RV   R|   t   SG_MAGICCONSTt   _e(   R*   t   alphat   betaR   t   ainvt   bbbt   cccRx   Ry   t   vR+   Rz   RZ   Rs   RR   t   p(    (    s   /usr/lib/python2.7/random.pyR   ì  sJ    	

	*		
	c         C   sƒ   |  j  } |  j } d |  _ | d k rw | ƒ  t } t d t d | ƒ  ƒ ƒ } t | ƒ | } t | ƒ | |  _ n  | | | S(   sØ   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.

        g       Àg      ð?N(   R   R)   R(   R~   R   RV   R€   t   _sin(   R*   Rv   Rw   R   Rz   t   x2pit   g2rad(    (    s   /usr/lib/python2.7/random.pyR   4  s    			c         C   s>   |  j  | d ƒ } | d k r" d S| | |  j  | d ƒ Sd S(   s   Beta distribution.

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

        g      ð?i    g        N(   R   (   R*   RŒ   R   t   y(    (    s   /usr/lib/python2.7/random.pyR   i  s    
c         C   s%   d |  j  ƒ  } d t | d | ƒ S(   s3   Pareto distribution.  alpha is the shape parameter.g      ð?(   R   t   pow(   R*   RŒ   Rs   (    (    s   /usr/lib/python2.7/random.pyR    {  s    c         C   s,   d |  j  ƒ  } | t t | ƒ d | ƒ S(   sf   Weibull distribution.

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

        g      ð?(   R   R—   RV   (   R*   RŒ   R   Rs   (    (    s   /usr/lib/python2.7/random.pyR!   „  s    N(#   t   __name__t
   __module__t   __doc__R4   R(   R,   R   R"   R#   R$   RD   RE   RG   R>   t   BPFR   R   RV   t   _MethodTypet   _BuiltinMethodTypeRH   R   R   R   R   R   R   R   R   R   R   R   R   R    R!   (    (    (    s   /usr/lib/python2.7/random.pyR   H   s8   							?			A					0	H	5			c           B   s\   e  Z d  Z d	 d „ Z d „  Z d „  Z d „  Z d „  Z d d d d „ Z	 d	 d „ Z
 RS(
   i   c         C   s  | d k rd y t t t d ƒ ƒ d ƒ } Wqd t k
 r` d d l } t | j ƒ  d ƒ } qd Xn  t | t t f ƒ sˆ t | ƒ } n  t	 | d ƒ \ } } t	 | d ƒ \ } } t	 | d ƒ \ } } t | ƒ d t | ƒ d t | ƒ d f |  _
 d |  _ d S(	   sü  Initialize 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 not None or an int or long, hash(a) is used instead.

        If a is an int or long, a is used directly.  Distinct values between
        0 and 27814431486575L inclusive are guaranteed to yield distinct
        internal states (this guarantee is specific to the default
        Wichmann-Hill generator).
        i   iÿÿÿÿNi   i<v  ibv  irv  i   (   R(   R-   R.   R/   R0   R1   Rh   R>   t   hasht   divmodt   _seedR)   (   R*   R3   R1   R+   R–   Rz   (    (    s   /usr/lib/python2.7/random.pyR   •  s    0c         C   sj   |  j  \ } } } d | d } d | d } d | d } | | | f |  _  | d | d | d	 d
 S(   s3   Get the next random number in the range [0.0, 1.0).i«   i=v  i¬   icv  iª   isv  g    @Ý@g    À˜Ý@g    ÀœÝ@g      ð?(   R    (   R*   R+   R–   Rz   (    (    s   /usr/lib/python2.7/random.pyR   ´  s    c         C   s   |  j  |  j |  j f S(   s9   Return internal state; can be passed to setstate() later.(   R4   R    R)   (   R*   (    (    s   /usr/lib/python2.7/random.pyR"   Ó  s    c         C   sK   | d } | d k r. | \ } |  _  |  _ n t d | |  j f ƒ ‚ d S(   s:   Restore internal state from object returned by getstate().i    i   s?   state with version %s passed to Random.setstate() of version %sN(   R    R)   R7   R4   (   R*   R9   R:   (    (    s   /usr/lib/python2.7/random.pyR#   ×  s
    
c         C   s£   | d k s t  d ƒ ‚ n  |  j \ } } } t | t d | d ƒ ƒ d } t | t d | d ƒ ƒ d } t | t d | d ƒ ƒ d } | | | f |  _ d	 S(
   sÃ  Act as if n calls to random() were made, but quickly.

        n is an int, greater than or equal to 0.

        Example use:  If you have 2 threads and know that each will
        consume no more than a million random numbers, create two Random
        objects r1 and r2, then do
            r2.setstate(r1.getstate())
            r2.jumpahead(1000000)
        Then r1 and r2 will use guaranteed-disjoint segments of the full
        period.
        i    s   n must be >= 0i«   i=v  i¬   icv  iª   isv  N(   R7   R    R>   R—   (   R*   RB   R+   R–   Rz   (    (    s   /usr/lib/python2.7/random.pyR$   á  s       i    c         C   s  t  | ƒ t  | ƒ k o4 t  | ƒ k o4 t k n sH t d ƒ ‚ n  d | k o_ d k  n o™ d | k o{ d k  n o™ d | k o— d k  n s« t d ƒ ‚ n  d | k oÍ | k oÍ | k n rNd d l } t | j ƒ  d ƒ } t | d @| d ?Aƒ } t | d ƒ \ } } t | d ƒ \ } } t | d ƒ \ } } n  | pWd	 | p`d	 | pid	 f |  _ d |  _	 d S(
   sj   Set the Wichmann-Hill seed from (x, y, z).

        These must be integers in the range [0, 256).
        s   seeds must be integersi    i   s   seeds must be in range(0, 256)iÿÿÿÿNiÿÿÿ i   i   (
   RT   R>   R8   R7   R1   R-   RŸ   R    R(   R)   (   R*   R+   R–   Rz   R1   t   t(    (    s   /usr/lib/python2.7/random.pyt   __whseed÷  s    9T'$c         C   s¸   | d k r |  j ƒ  d St | ƒ } t | d ƒ \ } } t | d ƒ \ } } t | d ƒ \ } } | | d pv d } | | d pŠ d } | | d pž d } |  j | | | ƒ d S(   sb  Seed from hashable object's hash code.

        None or no argument seeds from current time.  It is not guaranteed
        that objects with distinct hash codes lead to distinct internal
        states.

        This is obsolete, provided for compatibility with the seed routine
        used prior to Python 2.1.  Use the .seed() method instead.
        Ni   i   (   R(   t   _WichmannHill__whseedRž   RŸ   (   R*   R3   R+   R–   Rz   (    (    s   /usr/lib/python2.7/random.pyt   whseed  s    
N(   R˜   R™   R4   R(   R   R   R"   R#   R$   R£   R¤   (    (    (    s   /usr/lib/python2.7/random.pyR%   ‘  s   			
	c           B   sF   e  Z d  Z d „  Z d „  Z d „  Z e Z Z d „  Z e Z	 Z
 RS(   sÝ   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).
    c         C   s!   t  t t d ƒ ƒ d ƒ d ?t S(   s3   Get the next random number in the range [0.0, 1.0).i   i   i   (   R-   R.   R/   t	   RECIP_BPF(   R*   (    (    s   /usr/lib/python2.7/random.pyR   /  s    c         C   su   | d k r t  d ƒ ‚ n  | t | ƒ k r< t d ƒ ‚ n  | d d } t t t | ƒ ƒ d ƒ } | | d | ?S(   s>   getrandbits(k) -> x.  Generates a long int with k random bits.i    s(   number of bits must be greater than zeros#   number of bits should be an integeri   i   i   (   R7   R>   R8   R-   R.   R/   (   R*   RY   t   bytesR+   (    (    s   /usr/lib/python2.7/random.pyR&   3  s    c         O   s   d S(   s<   Stub method.  Not used for a system random number generator.N(   R(   (   R*   t   argst   kwds(    (    s   /usr/lib/python2.7/random.pyt   _stub=  s    c         O   s   t  d ƒ ‚ d S(   sA   Method should not be called for a system random number generator.s*   System entropy source does not have state.N(   R0   (   R*   R§   R¨   (    (    s   /usr/lib/python2.7/random.pyt   _notimplementedB  s    (   R˜   R™   Rš   R   R&   R©   R   R$   Rª   R"   R#   (    (    (    s   /usr/lib/python2.7/random.pyR'   '  s   		
	
	c         C   sõ   d d  l  } |  Gd G| j GHd } d } d } d } | j  ƒ  } xV t |  ƒ D]H }	 | | Œ  }
 | |
 7} | |
 |
 } t |
 | ƒ } t |
 | ƒ } qM W| j  ƒ  } t | | d ƒ Gd G| |  } t | |  | | ƒ } d | | | | f GHd  S(	   Niÿÿÿÿt   timesg        g    _ Bg    _ Âi   s   sec,s!   avg %g, stddev %g, min %g, max %g(   R1   R˜   t   ranget   mint   maxt   roundR   (   RB   t   funcR§   R1   t   totalt   sqsumt   smallestt   largestt   t0R_   R+   t   t1t   avgt   stddev(    (    s   /usr/lib/python2.7/random.pyt   _test_generatorI  s&    

iÐ  c         C   s  t  |  t d ƒ t  |  t d ƒ t  |  t d ƒ t  |  t d ƒ t  |  t d ƒ t  |  t d ƒ t  |  t d ƒ t  |  t d ƒ t  |  t d ƒ t  |  t d ƒ t  |  t d ƒ t  |  t d ƒ t  |  t d ƒ t  |  t d ƒ t  |  t d ƒ t  |  t d d d f ƒ d  S(   Ng        g      ð?g{®Gáz„?gš™™™™™¹?g       @g      à?gÍÌÌÌÌÌì?g      4@g      i@g      @(    (   g        g      ð?(   g        g      ð?(   g        g      ð?(   g{®Gáz„?g      ð?(   gš™™™™™¹?g      ð?(   gš™™™™™¹?g       @(   g      à?g      ð?(   gÍÌÌÌÌÌì?g      ð?(   g      ð?g      ð?(   g       @g      ð?(   g      4@g      ð?(   g      i@g      ð?(   g        g      ð?(   g      @g      @gUUUUUUÕ?(	   R¹   R   R   R   R   R   R   R   R   (   t   N(    (    s   /usr/lib/python2.7/random.pyt   _test_  s     t   __main__(K   Rš   t
   __future__R    t   warningsR   RU   t   typesR   Rœ   R   R   t   mathR   RV   R   R|   R   R   R   R‹   R   Rb   R	   R   R
   R‚   R   R€   R   R“   t   osR   R/   t   binasciiR   R.   t   hashlibR?   t   __all__Ru   R~   R‰   RŠ   R›   R¥   t   _randomR   R%   R'   R¹   R»   t   _instR   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R    R!   R"   R#   R$   R&   R˜   (    (    (    s   /usr/lib/python2.7/random.pyt   <module>(   sj   ("	
ÿ ÿ K–"																								