Browse Source

examples/renderer/02-primitives: seed the RNG.

Ryan C. Gordon 1 năm trước cách đây
mục cha
commit
62389ada6f
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 2 0
      examples/renderer/02-primitives/primitives.c

+ 2 - 0
examples/renderer/02-primitives/primitives.c

@@ -29,6 +29,8 @@ 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;