diff --git a/src/app.c b/src/app.c index b318fab..5644175 100644 --- a/src/app.c +++ b/src/app.c @@ -396,6 +396,7 @@ int app_init(App *app) { app->app_start_time = time(NULL); app->app_start_ticks = SDL_GetTicks64(); + srand((unsigned int)app->app_start_time); if (TTF_Init() != 0) { fprintf(stderr, "SDL_ttf init failed: %s\n", TTF_GetError()); diff --git a/src/app.o b/src/app.o index 247eeec..0da551d 100644 Binary files a/src/app.o and b/src/app.o differ diff --git a/src/channel.c b/src/channel.c index 34c4f74..fd0da12 100644 --- a/src/channel.c +++ b/src/channel.c @@ -213,7 +213,13 @@ static int load_channel_programs(Channel *channel, const char *channel_dir) { return 0; } - qsort(channel->programs, (size_t) channel->program_count, sizeof(ProgramEntry), compare_programs); + for (int i = channel->program_count - 1; i > 0; i--) { + int j = rand() % (i + 1); + ProgramEntry temp = channel->programs[i]; + channel->programs[i] = channel->programs[j]; + channel->programs[j] = temp; + } + channel->total_duration_seconds = 0.0; for (int i = 0; i < channel->program_count; ++i) { channel->programs[i].start_offset_seconds = channel->total_duration_seconds; diff --git a/src/channel.o b/src/channel.o index 1732d04..f0dff1a 100644 Binary files a/src/channel.o and b/src/channel.o differ