Skip to content

Commit

Permalink
pythongh-118392: Add note about random.random for multi thread app (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
corona10 authored and SonicField committed May 8, 2024
1 parent 8d41491 commit 09ecc79
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Doc/library/random.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------------------
Expand Down

0 comments on commit 09ecc79

Please sign in to comment.