bpo-39108: Document threading issues for random.gauss() (GH-22928) (GH-22972)

This commit is contained in:
Miss Skeleton (bot) 2020-10-25 08:48:38 -07:00 committed by GitHub
parent 2990aef0c8
commit af891a962b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View 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)