mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-06-03 18:37:40 +00:00
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).
This commit is contained in:
parent
671a33c2f7
commit
86ea283904
3 changed files with 0 additions and 6 deletions
|
@ -29,8 +29,6 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||||
return SDL_APP_FAILURE;
|
return SDL_APP_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_srand(0); /* seed the random number generator */
|
|
||||||
|
|
||||||
/* set up some random points */
|
/* set up some random points */
|
||||||
for (i = 0; i < SDL_arraysize(points); i++) {
|
for (i = 0; i < SDL_arraysize(points); i++) {
|
||||||
points[i].x = (SDL_randf() * 440.0f) + 100.0f;
|
points[i].x = (SDL_randf() * 440.0f) + 100.0f;
|
||||||
|
|
|
@ -26,8 +26,6 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||||
return SDL_APP_FAILURE;
|
return SDL_APP_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_srand(0); /* seed the random number generator */
|
|
||||||
|
|
||||||
return SDL_APP_CONTINUE; /* carry on with the program! */
|
return SDL_APP_CONTINUE; /* carry on with the program! */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,8 +46,6 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
|
||||||
return SDL_APP_FAILURE;
|
return SDL_APP_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_srand(0); /* seed the random number generator */
|
|
||||||
|
|
||||||
/* set up the data for a bunch of points. */
|
/* set up the data for a bunch of points. */
|
||||||
for (i = 0; i < SDL_arraysize(points); i++) {
|
for (i = 0; i < SDL_arraysize(points); i++) {
|
||||||
points[i].x = SDL_randf() * ((float) WINDOW_WIDTH);
|
points[i].x = SDL_randf() * ((float) WINDOW_WIDTH);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue