The function 'random' is, unlike 'rand', not marked as not MT-safe in POSIX [1][2]. Thus it must be multithread-safe [3]: "Each function defined in the System Interfaces volume of POSIX.1-2017 is thread-safe unless explicitly stated otherwise." And indeed glibc, musl libc, AIX, Android, and even NetBSD implement it in a multithread-safe way. On Cygwin 2.9.0 and 3.4.6, it is not multithread-safe. How to reproduce: 1. Compile the attached program. $ x86_64-pc-cygwin-gcc foo.c 2. Run it. $ ./a.exe Expected: No output. Actual: Output such as Expected value #367 not found in multithreaded results. [1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/initstate.html [2] https://pubs.opengroup.org/onlinepubs/9699919799/functions/rand.html [3] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_407