summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2020-10-25 14:59:01 (GMT)
committerGitHub <noreply@github.com>2020-10-25 14:59:01 (GMT)
commit3cde3788b68bce7deee1e6d31e265bbfce337731 (patch)
tree0c8d71f90615cb48e8177f83258458596afef87b /Doc
parente6a7ea4f2e0d6892ebd929235b1333f04b517eec (diff)
downloadcpython-3cde3788b68bce7deee1e6d31e265bbfce337731.zip
cpython-3cde3788b68bce7deee1e6d31e265bbfce337731.tar.gz
cpython-3cde3788b68bce7deee1e6d31e265bbfce337731.tar.bz2
bpo-39108: Document threading issues for random.gauss() (GH-22928)
Diffstat (limited to 'Doc')
-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 5a93594..c243ace 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)