From 07127e493a5d359c0d9e283c4fc7670823d76334 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 22 Nov 2025 23:42:18 -0800
Subject: [PATCH] Use SDL_rand_bits() to seed the random number generator
---
game/fastrand.cpp | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/game/fastrand.cpp b/game/fastrand.cpp
index e789742f..838c485c 100644
--- a/game/fastrand.cpp
+++ b/game/fastrand.cpp
@@ -22,10 +22,6 @@
/* -- Return a random value between 0 and range - 1 */
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-
#include <SDL3/SDL.h>
#include "fastrand.h"
@@ -41,8 +37,7 @@ void SeedRandom(Uint32 Seed)
fprintf(stderr, "SeedRandom(%8.8x)\n", Seed);
#endif
if ( ! Seed ) {
- srand(time(NULL));
- Seed = (((rand()%0xFFFF)<<16)|(rand()%0xFFFF));
+ Seed = SDL_rand_bits();
}
randomSeed = Seed;
}