From 86ea283904f6a4529d591909d6b0b0e6fa8fe7f0 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 26 Sep 2024 15:01:04 -0400
Subject: [PATCH] examples: No need to explicitly seed the RNG at startup.
SDL does this for you; explicit seeding is only for reproducing a specific
sequence of numbers (or maybe reseeding at a later point).
---
examples/renderer/02-primitives/primitives.c | 2 --
examples/renderer/03-lines/lines.c | 2 --
examples/renderer/04-points/points.c | 2 --
3 files changed, 6 deletions(-)
diff --git a/examples/renderer/02-primitives/primitives.c b/examples/renderer/02-primitives/primitives.c
index 28cba4396c9e6..daa4be28fd053 100644
--- a/examples/renderer/02-primitives/primitives.c
+++ b/examples/renderer/02-primitives/primitives.c
@@ -29,8 +29,6 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
return SDL_APP_FAILURE;
}
- SDL_srand(0); /* seed the random number generator */
-
/* set up some random points */
for (i = 0; i < SDL_arraysize(points); i++) {
points[i].x = (SDL_randf() * 440.0f) + 100.0f;
diff --git a/examples/renderer/03-lines/lines.c b/examples/renderer/03-lines/lines.c
index 459af73d1cae6..031077000b562 100644
--- a/examples/renderer/03-lines/lines.c
+++ b/examples/renderer/03-lines/lines.c
@@ -26,8 +26,6 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
return SDL_APP_FAILURE;
}
- SDL_srand(0); /* seed the random number generator */
-
return SDL_APP_CONTINUE; /* carry on with the program! */
}
diff --git a/examples/renderer/04-points/points.c b/examples/renderer/04-points/points.c
index 468a30abd4a2e..c98fb9b32c142 100644
--- a/examples/renderer/04-points/points.c
+++ b/examples/renderer/04-points/points.c
@@ -46,8 +46,6 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
return SDL_APP_FAILURE;
}
- SDL_srand(0); /* seed the random number generator */
-
/* set up the data for a bunch of points. */
for (i = 0; i < SDL_arraysize(points); i++) {
points[i].x = SDL_randf() * ((float) WINDOW_WIDTH);