https://github.com/python/cpython/commit/11cbf77f9799e86603bca927a98959c7b94fff80
commit: 11cbf77f9799e86603bca927a98959c7b94fff80
branch: main
author: Donghee Na <[email protected]>
committer: corona10 <[email protected]>
date: 2024-04-30T13:42:13+09:00
summary:

gh-118392: Add note about random.random for multi thread app (gh-118396)

files:
M Doc/library/random.rst

diff --git a/Doc/library/random.rst b/Doc/library/random.rst
index 8fbce18c56f17c..61798263d61195 100644
--- a/Doc/library/random.rst
+++ b/Doc/library/random.rst
@@ -59,6 +59,12 @@ from sources provided by the operating system.
    random number generator with a long period and comparatively simple update
    operations.
 
+.. note::
+   The global random number generator and instances of :class:`Random` are 
thread-safe.
+   However, in the free-threaded build, concurrent calls to the global 
generator or
+   to the same instance of :class:`Random` may encounter contention and poor 
performance.
+   Consider using separate instances of :class:`Random` per thread instead.
+
 
 Bookkeeping functions
 ---------------------

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to