diff options
author | infirit <[email protected]> | 2014-07-25 15:26:50 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2014-07-25 15:26:50 +0200 |
commit | 716caf1ea3be8fe204d6616f9875a5c8f5d17a01 (patch) | |
tree | 4740ba5a15c604e0644928b6a4ddd2ea11ca390c /src/eom-thumb-view.c | |
parent | 9432c69d9bd5826bc975221f18427a4ba228574b (diff) | |
download | eom-716caf1ea3be8fe204d6616f9875a5c8f5d17a01.tar.bz2 eom-716caf1ea3be8fe204d6616f9875a5c8f5d17a01.tar.xz |
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 <[email protected]>
Diffstat (limited to 'src/eom-thumb-view.c')
-rw-r--r-- | src/eom-thumb-view.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; } } |