--- /tmp/x-orig/xscreensaver-5.04/hacks/deco.c 2007-08-30 02:38:57.000000000 -0400 +++ deco.c 2008-11-03 21:36:08.000000000 -0500 @@ -155,6 +155,32 @@ st->min_height = st->min_width = h/8; } } + +double +uniform_random() +{ + double x=random(); + x/=(RAND_MAX+1.0); + return x; +} +int +random_weighted(int w, int h) +{ + double x=uniform_random(); + /*fprintf(stderr,"%f\n",x);*/ + x*=((double)w)+((double)h); + /*return (xh); +} + +double +one_third_random() +{ + double x=uniform_random(); + x/=3; + x+=(1.0/3); + return x; +} static void deco (Display *dpy, Window window, struct state *st, @@ -173,15 +199,15 @@ } else { - if ((st->goldenRatio || st->mondrian) ? (w > h) : (random() & 1)) + if ((st->goldenRatio || st->mondrian) ? (w > h) : (random_weighted(w,h))) { /* Divide the rectangle side-by-side */ - int wnew = (st->goldenRatio ? (w * (random() & 1 ? PHI1 : PHI2)) : w/2); + int wnew = (st->goldenRatio ? (w * (random() & 1 ? PHI1 : PHI2)) : w*one_third_random()); deco (dpy, window, st, x, y, wnew, h, depth+1); deco (dpy, window, st, x+wnew, y, w-wnew, h, depth+1); } else { /* Divide the rectangle top-to-bottom */ - int hnew = (st->goldenRatio ? (h * (random() & 1 ? PHI1 : PHI2)) : h/2); + int hnew = (st->goldenRatio ? (h * (random() & 1 ? PHI1 : PHI2)) : h*one_third_random()); deco (dpy, window, st, x, y, w, hnew, depth+1); deco (dpy, window, st, x, y+hnew, w, h-hnew, depth+1); } @@ -302,12 +328,12 @@ static const char *deco_defaults [] = { ".background: black", ".foreground: white", - "*maxDepth: 12", - "*minWidth: 20", - "*minHeight: 20", + "*maxDepth: 20", + "*minWidth: 5", + "*minHeight: 5", "*lineWidth: 1", "*delay: 5", - "*ncolors: 64", + "*ncolors: 200", "*goldenRatio: False", "*smoothColors: False", "*mondrian: False",