Uh oh!
There was an error while loading. Please reload this page.
gh-118392: Add note about random.random for multi thread app - #118396
Conversation
| .. warning:: | ||
| Calling this function in the concurrent use can cause performance degradation. | ||
| Instead, Consider using :class:`Random` per thread. | ||
There was a problem hiding this comment.
Let's move this up to the module level, perhaps between the security warning and the "see also". The advice is not limited this function.
I think maybe a .. note:: is more appropriate. A red "warning" seems a bit severe to me.
For the text, something like:
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.
There was a problem hiding this comment.
I agree. This replaces my comment.
Uh oh!
There was an error while loading. Please reload this page.
When you're done making the requested changes, leave the comment: |
corona10
commented
Apr 30, 2024
I have made the requested changes; please review again |
Thanks for making the requested changes! @terryjreedy: please review the changes made to this pull request. |
📚 Documentation preview 📚: https://cpython-previews--118396.org.readthedocs.build/