aboutsummaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
Diffstat (limited to 'code')
-rw-r--r--code/client/cl_main.c6
-rw-r--r--code/qcommon/common.c1
-rw-r--r--code/renderer/tr_noise.c2
-rw-r--r--code/server/sv_init.c1
4 files changed, 1 insertions, 9 deletions
diff --git a/code/client/cl_main.c b/code/client/cl_main.c
index 01c044a..814e7ab 100644
--- a/code/client/cl_main.c
+++ b/code/client/cl_main.c
@@ -1306,11 +1306,7 @@ void CL_RequestMotd( void ) {
BigShort( cls.updateServer.port ) );
info[0] = 0;
- // NOTE TTimo xoring against Com_Milliseconds, otherwise we may not have a true randomization
- // only srand I could catch before here is tr_noise.c l:26 srand(1001)
- // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=382
- // NOTE: the Com_Milliseconds xoring only affects the lower 16-bit word,
- // but I decided it was enough randomization
+
Com_sprintf( cls.updateChallenge, sizeof( cls.updateChallenge ), "%i", ((rand() << 16) ^ rand()) ^ Com_Milliseconds());
Info_SetValueForKey( info, "challenge", cls.updateChallenge );
diff --git a/code/qcommon/common.c b/code/qcommon/common.c
index fb9f664..02b22d2 100644
--- a/code/qcommon/common.c
+++ b/code/qcommon/common.c
@@ -3340,7 +3340,6 @@ void Com_RandomBytes( byte *string, int len )
return;
Com_Printf( "Com_RandomBytes: using weak randomization\n" );
- srand( time( 0 ) );
for( i = 0; i < len; i++ )
string[i] = (unsigned char)( rand() % 255 );
}
diff --git a/code/renderer/tr_noise.c b/code/renderer/tr_noise.c
index 5d550a3..af2f84e 100644
--- a/code/renderer/tr_noise.c
+++ b/code/renderer/tr_noise.c
@@ -44,8 +44,6 @@ void R_NoiseInit( void )
{
int i;
- srand( 1001 );
-
for ( i = 0; i < NOISE_SIZE; i++ )
{
s_noise_table[i] = ( float ) ( ( ( rand() / ( float ) RAND_MAX ) * 2.0 - 1.0 ) );
diff --git a/code/server/sv_init.c b/code/server/sv_init.c
index 874aeaf..e68d782 100644
--- a/code/server/sv_init.c
+++ b/code/server/sv_init.c
@@ -475,7 +475,6 @@ void SV_SpawnServer( char *server, qboolean killBots ) {
Cvar_Set("cl_paused", "0");
// get a new checksum feed and restart the file system
- srand(Com_Milliseconds());
sv.checksumFeed = ( ((int) rand() << 16) ^ rand() ) ^ Com_Milliseconds();
FS_Restart( sv.checksumFeed );