https://bugs.winehq.org/show_bug.cgi?id=46273
Bug ID: 46273 Summary: rand() doesn't get a unique state per-fiber like it appears to on native windows Product: Wine Version: 1.8.7 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: winecrt0 Assignee: wine-bugs@winehq.org Reporter: winebz@pengaru.com Distribution: ---
I've been using WINE to test windows builds during game development in Debian GNU/Linux.
I use the windows fibers API to implement coroutines and in testing on Win7 noticed a bunch of coroutine-backed game objects using rand() for randomized visible things were unexpectedly looking uniform. In WINE they had all appeared distinctly random.
I'm not an experienced windows developer, but it /appears/ that in Win7, calling rand() in a newly created fiber restarts from the default seed rather than sharing the same PRNG state with the other fibers. It's rather odd, but I verified it with a smaller test program that only printed the return value from rand() in new fibers, and they were all printing the same value.
It's possible this is already fixed in a newer WINE version, I'm limited to what's bundled in debian 9.5 (1.8.7). Or maybe this is considered a Windows bug and WINE's behavior is deliberately different.