Hello Joachim, hello Brian,

I noticed the same behaviour of unicode-screensaver and tried to fix it -- I 
think what might have been missing was the initializiation of the PRNG with 
some seed.  The following patch works around this issue by using 
arc4random_uniform() instead of random() (according to arc4random(3) this 
avoids "modulo bias") from libbsd-dev (what would be another dependency, tho).

HTH and greetings,
Stephan

---
 configure.ac |    1 +
 unicode.c    |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index f5fd726..bbdbb21 100644
--- a/configure.ac
+++ b/configure.ac
@@ -277,5 +277,6 @@ AC_GETTIMEOFDAY_ARGS
 
 # Checks for library functions.
 
+AC_CHECK_LIB(bsd,arc4random)
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/unicode.c b/unicode.c
index 3c19244..f22629d 100644
--- a/unicode.c
+++ b/unicode.c
@@ -128,9 +128,9 @@ unicode_draw (Display *dpy, Window win, void *void_state) {
                XWindowAttributes xgwa;
                XGetWindowAttributes (dpy, win, &xgwa);
 
-               font = random() % NUM_FONTS;
+               font = arc4random_uniform(NUM_FONTS);
 
-               pickn = random() % state->font_count[font];     
+               pickn = arc4random_uniform(state->font_count[font]);    
 
                pickc = 0;
                for (ucs4 = FcCharSetFirstPage (state->fonts[font]->charset, 
map, &next);
-- 
1.7.0.2




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to