summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-07-25 15:26:50 +0200
committerinfirit <[email protected]>2014-07-25 15:26:50 +0200
commit716caf1ea3be8fe204d6616f9875a5c8f5d17a01 (patch)
tree4740ba5a15c604e0644928b6a4ddd2ea11ca390c /src
parent9432c69d9bd5826bc975221f18427a4ba228574b (diff)
downloadeom-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')
-rw-r--r--src/eom-thumb-view.c4
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;
}
}