summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorMiss Skeleton (bot) <31488909+miss-islington@users.noreply.github.com>2020-10-25 15:48:38 (GMT)
committerGitHub <noreply@github.com>2020-10-25 15:48:38 (GMT)
commitaf891a962b62268d76ace0d4768ab0e1934a2cd1 (patch)
tree35a7bf8c064d0fdcadb3e16300bdd1ca391c4c00 /Doc/library
parent2990aef0c804b5d8956c221540bb639983fc0ae4 (diff)
downloadcpython-af891a962b62268d76ace0d4768ab0e1934a2cd1.zip
cpython-af891a962b62268d76ace0d4768ab0e1934a2cd1.tar.gz
cpython-af891a962b62268d76ace0d4768ab0e1934a2cd1.tar.bz2
bpo-39108: Document threading issues for random.gauss() (GH-22928) (GH-22972)
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/random.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/library/random.rst b/Doc/library/random.rst
index f9535d7..8154dfc 100644
--- a/Doc/library/random.rst
+++ b/Doc/library/random.rst
@@ -319,6 +319,13 @@ be found in any statistics text.
deviation. This is slightly faster than the :func:`normalvariate` function
defined below.
+ Multithreading note: When two threads call this function
+ simultaneously, it is possible that they will receive the
+ same return value. This can be avoided in three ways.
+ 1) Have each thread use a different instance of the random
+ number generator. 2) Put locks around all calls. 3) Use the
+ slower, but thread-safe :func:`normalvariate` function instead.
+
.. function:: lognormvariate(mu, sigma)