]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39108: Document threading issues for random.gauss() (GH-22928) (GH-22972)
authorMiss Skeleton (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 25 Oct 2020 15:48:38 +0000 (08:48 -0700)
committerGitHub <noreply@github.com>
Sun, 25 Oct 2020 15:48:38 +0000 (08:48 -0700)
Doc/library/random.rst

index f9535d7d1b9a224f7d3b6a68dcfdf2827d110d9b..8154dfc18ccc6db63d48f84082e4d0e203a127c3 100644 (file)
@@ -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)