gh-118392: Update genrand_uint32 to use atomic operation by corona10 · Pull Request #118393 · python/cpython
I don't think there's a simple fix to the random module.
I commented on the issue. It'd be helpful to document the behavior and provide alternatives. For example, Java's java.util.Random includes the following comment:
Instances of java.util.Random are threadsafe. However, the concurrent use of the same java.util.Random instance across threads may encounter contention and consequent poor performance. Consider instead using ThreadLocalRandom in multithreaded designs.