Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 39706
Collapse All | Expand All

(-)/var/tmp/portage/xmms-1.2.9_pre1/work/xmms-1.2.9-pre1/xmms/main.c.old (-1 / +17 lines)
Lines 26-31 Link Here
26
#include <getopt.h>
26
#include <getopt.h>
27
#include <signal.h>
27
#include <signal.h>
28
#include <ctype.h>
28
#include <ctype.h>
29
#include <fcntl.h>
29
#ifdef HAVE_SCHED_H
30
#ifdef HAVE_SCHED_H
30
# include <sched.h>
31
# include <sched.h>
31
#elif defined HAVE_SYS_SCHED_H
32
#elif defined HAVE_SYS_SCHED_H
Lines 38-43 Link Here
38
#include "charset.h"
39
#include "charset.h"
39
#include "xmms_mini.xpm"
40
#include "xmms_mini.xpm"
40
41
42
#define RNDTBL_SIZE   93
43
41
GtkWidget *mainwin, *mainwin_url_window = NULL, *mainwin_dir_browser = NULL;
44
GtkWidget *mainwin, *mainwin_url_window = NULL, *mainwin_dir_browser = NULL;
42
GtkWidget *mainwin_jtt = NULL, *mainwin_jtf = NULL;
45
GtkWidget *mainwin_jtt = NULL, *mainwin_jtf = NULL;
43
GtkItemFactory *mainwin_options_menu, *mainwin_songname_menu, *mainwin_vis_menu;
46
GtkItemFactory *mainwin_options_menu, *mainwin_songname_menu, *mainwin_vis_menu;
Lines 3557-3563 Link Here
3557
#if defined(HAVE_SRANDOMDEV)
3560
#if defined(HAVE_SRANDOMDEV)
3558
	srandomdev();
3561
	srandomdev();
3559
#else
3562
#else
3560
	srandom(time(NULL));
3563
	int fd = open ("/dev/urandom", O_RDONLY);
3564
	int i, randnum;
3565
	char randtbl2[RNDTBL_SIZE + 1] = { 0 };
3566
	if (fd != -1) {
3567
		for (i=0; i<RNDTBL_SIZE; i++) {
3568
			read(fd, &randnum, 4 );
3569
			randtbl2[i+1] = randnum;
3570
			// printf("Random number : %d\n",randnum);
3571
		}
3572
		initstate(time(NULL), randtbl2, RNDTBL_SIZE+1);
3573
		close(fd);
3574
	} else {
3575
		srandom(time(NULL));
3576
	}
3561
#endif
3577
#endif
3562
3578
3563
	read_config();
3579
	read_config();
(-)/var/tmp/portage/xmms-1.2.9_pre1/work/xmms-1.2.9-pre1/xmms/playlist.c.old (-3 / +3 lines)
Lines 545-551 Link Here
545
		/* If there are entries */
545
		/* If there are entries */
546
		if (g_list_length(skinlist)) {
546
		if (g_list_length(skinlist)) {
547
			/* Get a random value to select the skin to use */
547
			/* Get a random value to select the skin to use */
548
			int randval = random() % (g_list_length(skinlist) + 1);
548
			int randval = (gint)(random() / (RAND_MAX + 1.0) * (g_list_length(skinlist) + 1));
549
			/* If the random value is 0, use the default skin */
549
			/* If the random value is 0, use the default skin */
550
			/* Otherwise subtract 1 from the random value and */
550
			/* Otherwise subtract 1 from the random value and */
551
			/* select the skin */
551
			/* select the skin */
Lines 1899-1905 Link Here
1899
			{
1899
			{
1900
				/* Only find new songs in our current
1900
				/* Only find new songs in our current
1901
				   score section */
1901
				   score section */
1902
				j = (rand() % (next_score_section - i)) + i;
1902
				j = (gint)(random() / (RAND_MAX + 1.0) * (next_score_section - i)) + i;
1903
1903
1904
				assert(j < next_score_section);
1904
				assert(j < next_score_section);
1905
			}
1905
			}
Lines 1984-1990 Link Here
1984
		gint j;
1984
		gint j;
1985
1985
1986
		/* Pick a random song among the ones that are left */
1986
		/* Pick a random song among the ones that are left */
1987
		j = (rand() % (len - i)) + i;
1987
		j = (gint)(random() / (RAND_MAX + 1.0) * (len - i)) + i;
1988
1988
1989
		/* Swap pointer #i and pointer #j */
1989
		/* Swap pointer #i and pointer #j */
1990
		swap_ptr = ptrs[i];
1990
		swap_ptr = ptrs[i];

Return to bug 39706