Document differences between random.choices() and random.choice(). (GH-11703) (GH-11706)

This commit is contained in:
Miss Islington (bot) 2019-01-30 13:49:23 -08:00 committed by Raymond Hettinger
parent 7516f265a8
commit e31f8604e6

View file

@ -162,6 +162,13 @@ Functions for sequences
with the :class:`float` values returned by :func:`random` (that includes
integers, floats, and fractions but excludes decimals).
For a given seed, the :func:`choices` function with equal weighting
typically produces a different sequence than repeated calls to
:func:`choice`. The algorithm used by :func:`choices` uses floating
point arithmetic for internal consistency and speed. The algorithm used
by :func:`choice` defaults to integer arithmetic with repeated selections
to avoid small biases from round-off error.
.. versionadded:: 3.6