summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2023-12-03 19:07:00 -0500
committerRay Strode <rstrode@redhat.com>2023-12-04 07:49:31 -0500
commit54b390e35c1a639cc9675f24567c82cbe477e11b (patch)
tree0502c07e8d4a926bf1f4c81b4e4d0fa9947d4661
parent75d371edeff1ec0f47218a7d5e2f0696950a47e7 (diff)
space-flares: Use new ply_get_random_number function
-rw-r--r--src/plugins/splash/space-flares/plugin.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/plugins/splash/space-flares/plugin.c b/src/plugins/splash/space-flares/plugin.c
index bea8acc6..f5f1666e 100644
--- a/src/plugins/splash/space-flares/plugin.c
+++ b/src/plugins/splash/space-flares/plugin.c
@@ -525,7 +525,6 @@ create_plugin (ply_key_file_t *key_file)
ply_boot_splash_plugin_t *plugin;
char *image_dir, *image_path;
- srand ((int) ply_get_timestamp ());
plugin = calloc (1, sizeof(ply_boot_splash_plugin_t));
plugin->logo_image = ply_image_new (PLYMOUTH_LOGO_FILE);
@@ -965,12 +964,12 @@ static void
flare_reset (flare_t *flare,
int index)
{
- flare->rotate_yz[index] = ((float) (rand () % 1000) / 1000) * 2 * M_PI;
- flare->rotate_xy[index] = ((float) (rand () % 1000) / 1000) * 2 * M_PI;
- flare->rotate_xz[index] = ((float) (rand () % 1000) / 1000) * 2 * M_PI;
- flare->y_size[index] = ((float) (rand () % 1000) / 1000) * 0.8 + 0.2;
- flare->increase_speed[index] = ((float) (rand () % 1000) / 1000) * 0.08 + 0.08;
- flare->stretch[index] = (((float) (rand () % 1000) / 1000) * 0.1 + 0.3) * flare->y_size[index];
+ flare->rotate_yz[index] = ((float) (ply_get_random_number (0, 1000)) / 1000) * 2 * M_PI;
+ flare->rotate_xy[index] = ((float) (ply_get_random_number (0, 1000)) / 1000) * 2 * M_PI;
+ flare->rotate_xz[index] = ((float) (ply_get_random_number (0, 1000)) / 1000) * 2 * M_PI;
+ flare->y_size[index] = ((float) (ply_get_random_number (0, 1000)) / 1000) * 0.8 + 0.2;
+ flare->increase_speed[index] = ((float) (ply_get_random_number (0, 1000)) / 1000) * 0.08 + 0.08;
+ flare->stretch[index] = (((float) (ply_get_random_number (0, 1000)) / 1000) * 0.1 + 0.3) * flare->y_size[index];
flare->z_offset_strength[index] = 0.1;
}
@@ -1537,8 +1536,8 @@ view_setup_scene (view_t *view)
for (i = 0; i < star_bg->star_count; i++) {
do {
- x = rand () % screen_width;
- y = rand () % screen_height;
+ x = ply_get_random_number (0, screen_width);
+ y = ply_get_random_number (0, screen_height);
} while (image_data[x + y * screen_width] == 0xFFFFFFFF);
star_bg->star_refresh[i] = 0;
star_bg->star_x[i] = x;
@@ -1546,8 +1545,8 @@ view_setup_scene (view_t *view)
image_data[x + y * screen_width] = 0xFFFFFFFF;
}
for (i = 0; i < (int) (screen_width * screen_height) / 400; i++) {
- x = rand () % screen_width;
- y = rand () % screen_height;
+ x = ply_get_random_number (0, screen_width);
+ y = ply_get_random_number (0, screen_height);
image_data[x + y * screen_width] = star_bg_gradient_colour (x, y, screen_width, screen_height, true, ((float) x * y * 13 / 10000));
}