Skip to content

Commit 09ecc79

Browse files
corona10SonicField
authored andcommitted
pythongh-118392: Add note about random.random for multi thread app (pythongh-118396)
1 parent 8d41491 commit 09ecc79

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Doc/library/random.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ from sources provided by the operating system.
5959
random number generator with a long period and comparatively simple update
6060
operations.
6161

62+
.. note::
63+
The global random number generator and instances of :class:`Random` are thread-safe.
64+
However, in the free-threaded build, concurrent calls to the global generator or
65+
to the same instance of :class:`Random` may encounter contention and poor performance.
66+
Consider using separate instances of :class:`Random` per thread instead.
67+
6268

6369
Bookkeeping functions
6470
---------------------

0 commit comments

Comments
 (0)