Open PierreMarieBaty opened 8 months ago
Looks like IRandomBetween
is a bit more complicated.
Does the following work for you on Windows?
int IRandomBetween(int pA, int pB) {
long long int a = rand() * (pB + 1 - pA);
a &= 0x7fffffffffffffff;
return pA + (a >> 15);
}
Seems to work!
I have no idea of the "randomness" of such a distribution though. While I was relying on the floating-point code, I found out that it had made the game much more interesting (esp. the pedestrians behaviour). I'll soon see what changes in this regard.
Message ID: @.***>
When compiling on Win32/x86, I couldn't get the new game video, which should be 50% chance either GARAGE1.SMK or GARAGE2.SMK to play the first one.
After investigation it turned out the culprit was this function in src/DETHRACE/common/utility.c:
I changed it to the following so that it falls back on the floating-point based code when sizeof(int) is 32 bit:
I haven't tested when compiling for Win32/x64 though, but considering Windows is the only well-known x64 platform where sizeof(int) is 4, it should be the same.