From 716caf1ea3be8fe204d6616f9875a5c8f5d17a01 Mon Sep 17 00:00:00 2001 From: infirit Date: Fri, 25 Jul 2014 15:26:50 +0200 Subject: Use GRandom as random value generator for random image function Seems to have a better distribution. At least works better with lower image counts. Eom bug https://bugzilla.gnome.org/show_bug.cgi?id=633746 Based on eog commit 88407daf16b509dc33256ad11a8941a8eb4e3eb4 From Felix Riemann --- src/eom-thumb-view.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/eom-thumb-view.c b/src/eom-thumb-view.c index b9065d8..eb40d01 100644 --- a/src/eom-thumb-view.c +++ b/src/eom-thumb-view.c @@ -841,7 +841,7 @@ eom_thumb_view_select_single (EomThumbView *thumbview, path = gtk_tree_path_new_from_indices (n_items - 1, -1); break; case EOM_THUMB_VIEW_SELECT_RANDOM: - path = gtk_tree_path_new_from_indices ((int)(((float)(n_items - 1) * rand()) / (float)(RAND_MAX + 1.f)), -1); + path = gtk_tree_path_new_from_indices (g_random_int_range (0, n_items), -1); break; } } else { @@ -879,7 +879,7 @@ eom_thumb_view_select_single (EomThumbView *thumbview, break; case EOM_THUMB_VIEW_SELECT_RANDOM: gtk_tree_path_free (path); - path = gtk_tree_path_new_from_indices ((int)(((float)(n_items - 1) * rand()) / (float)(RAND_MAX + 1.f)), -1); + path = gtk_tree_path_new_from_indices (g_random_int_range (0, n_items), -1); break; } } -- cgit v1.2.1