summaryrefslogtreecommitdiff
path: root/src/collage.c
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-10-17 20:40:17 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-10-17 20:40:17 +0200
commit9803fc41e8e6a820634f41d2196bdced7cbbc99f (patch)
tree593f59640ebe9d8eef90e3ddf8988dc7d714690c /src/collage.c
parenta9d46da64d02561bf2f545b3271575b304eda913 (diff)
Use random() instead of rand() to increase portability
Quoting glibc rand(3): The versions of rand() and srand() in the Linux C Library use the same random number generator as random(3) and srandom(3), so the lower-order bits should be as random as the higher-order bits. However, on older rand() implementations, and on current implementations on different systems, the lower-order bits are much less random than the higher-order bits. Do not use this function in applications intended to be portable when good randomness is needed. (Use random(3) instead.)
Diffstat (limited to 'src/collage.c')
-rw-r--r--src/collage.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/collage.c b/src/collage.c
index 2a4d9f9..b616bef 100644
--- a/src/collage.c
+++ b/src/collage.c
@@ -145,8 +145,8 @@ void init_collage_mode(void)
}
/* pick random coords for thumbnail */
- xxx = ((w - www) * ((double) rand() / RAND_MAX));
- yyy = ((h - hhh) * ((double) rand() / RAND_MAX));
+ xxx = ((w - www) * ((double) random() / RAND_MAX));
+ yyy = ((h - hhh) * ((double) random() / RAND_MAX));
D(("image going on at x=%d, y=%d\n", xxx, yyy));
im_thumb = gib_imlib_create_cropped_scaled_image(im_temp,