Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 24137 | Differences between
and this patch

Collapse All | Expand All

(-)xmms/playlist.c.old (-3 / +4 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 len = (g_list_length(skinlist) + 1); 
549
			int randval = (int)((double)random() / RAND_MAX * len);
549
			/* If the random value is 0, use the default skin */
550
			/* If the random value is 0, use the default skin */
550
			/* Otherwise subtract 1 from the random value and */
551
			/* Otherwise subtract 1 from the random value and */
551
			/* select the skin */
552
			/* select the skin */
Lines 1887-1893 Link Here
1887
                        {
1888
                        {
1888
                                /* Only find new songs in our current
1889
                                /* Only find new songs in our current
1889
                                   score section */
1890
                                   score section */
1890
                                j = (rand() % (next_score_section - i)) + i;
1891
				j = (gint)((double)random() / RAND_MAX * (next_score_section - i)) + i;
1891
1892
1892
                                assert(j < next_score_section);
1893
                                assert(j < next_score_section);
1893
                        }
1894
                        }
Lines 1970-1976 Link Here
1970
                gint j;
1971
                gint j;
1971
1972
1972
                /* Pick a random song among the ones that are left */
1973
                /* Pick a random song among the ones that are left */
1973
                j = (rand() % (len - i)) + i;
1974
		j = (gint)((double)random() / RAND_MAX * len);
1974
1975
1975
                /* Swap pointer #i and pointer #j */
1976
                /* Swap pointer #i and pointer #j */
1976
                swap_ptr = ptrs[i];
1977
                swap_ptr = ptrs[i];

Return to bug 24137