Skip to content
This repository has been archived by the owner on Aug 24, 2023. It is now read-only.

Commit

Permalink
More damn aliasing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Poncelet committed Apr 7, 2023
1 parent 4e1765f commit 3fbe6d1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion game_libs/cl_dll/com_weapons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,20 @@ UTIL_SharedRandomFloat
*/
float UTIL_SharedRandomFloat( unsigned int seed, float low, float high )
{
union FloatInt
{
float f;
int i;
};

unsigned int range;
FloatInt lowVal;
FloatInt highVal;

lowVal.f = low;
highVal.f = high;

U_Srand( (int)seed + *(int *)&low + *(int *)&high );
U_Srand( (int)seed + lowVal.i + highVal.i );

U_Random();
U_Random();
Expand Down

0 comments on commit 3fbe6d1

Please sign in to comment.