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

This commit is contained in:
Raymond Hettinger 2019-01-30 13:30:20 -08:00 committed by GitHub
parent cf991e653a
commit 40ebe948e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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