Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/library/random.rst

    r2 r391  
    1 
    21:mod:`random` --- Generate pseudo-random numbers
    32================================================
     
    65   :synopsis: Generate pseudo-random numbers with various common distributions.
    76
     7**Source code:** :source:`Lib/random.py`
     8
     9--------------
    810
    911This module implements pseudo-random number generators for various
     
    5355
    5456.. versionchanged:: 2.3
    55    Substituted MersenneTwister for Wichmann-Hill.
     57   MersenneTwister replaced Wichmann-Hill as the default generator.
     58
     59The :mod:`random` module also provides the :class:`SystemRandom` class which
     60uses the system function :func:`os.urandom` to generate random numbers
     61from sources provided by the operating system.
     62
     63.. warning::
     64
     65   The pseudo-random generators of this module should not be used for
     66   security purposes.  Use :func:`os.urandom` or :class:`SystemRandom` if
     67   you require a cryptographically secure pseudo-random number generator.
     68
    5669
    5770Bookkeeping functions:
     
    7083      formerly, operating system resources were not used.
    7184
    72    If *x* is not ``None`` or an int or long, ``hash(x)`` is used instead. If *x* is
    73    an int or long, *x* is used directly.
    74 
    75 
    7685.. function:: getstate()
    7786
     
    8998   *state* should have been obtained from a previous call to :func:`getstate`, and
    9099   :func:`setstate` restores the internal state of the generator to what it was at
    91    the time :func:`setstate` was called.
     100   the time :func:`getstate` was called.
    92101
    93102   .. versionadded:: 2.1
     
    123132
    124133
    125 .. function:: randrange([start,] stop[, step])
     134.. function:: randrange(stop)
     135              randrange(start, stop[, step])
    126136
    127137   Return a randomly selected element from ``range(start, stop, step)``.  This is
     
    195205   depending on floating-point rounding in the equation ``a + (b-a) * random()``.
    196206
     207
    197208.. function:: triangular(low, high, mode)
    198209
     
    224235   Gamma distribution.  (*Not* the gamma function!)  Conditions on the
    225236   parameters are ``alpha > 0`` and ``beta > 0``.
     237
     238   The probability distribution function is::
     239
     240                 x ** (alpha - 1) * math.exp(-x / beta)
     241       pdf(x) =  --------------------------------------
     242                   math.gamma(alpha) * beta ** alpha
    226243
    227244
Note: See TracChangeset for help on using the changeset viewer.