summaryrefslogtreecommitdiff
path: root/apps/playlist.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-06-04 21:50:45 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-06-04 21:50:45 +0000
commitd4c9173888e86582681bcb45a0fa8e397e83dbc8 (patch)
treea80409e68e4553290b143e861b229a81e8891c0a /apps/playlist.c
parent4bf52eae14be82230f7aff9010003725e84ce3e3 (diff)
downloadrockbox-d4c9173888e86582681bcb45a0fa8e397e83dbc8.tar.gz
rockbox-d4c9173888e86582681bcb45a0fa8e397e83dbc8.zip
added some stupid faked random functions too, to build on target
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@894 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/playlist.c')
-rw-r--r--apps/playlist.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/apps/playlist.c b/apps/playlist.c
index 60786f67ce..f0fa40bb98 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -128,6 +128,23 @@ void add_indices_to_playlist( playlist_info_t *playlist )
128 close(fd); 128 close(fd);
129} 129}
130 130
131static unsigned int playlist_seed = 0xdeadcafe;
132void seedit(unsigned int seed)
133{
134 playlist_seed = seed;
135}
136
137int getrand(void)
138{
139 playlist_seed += 0x12345;
140
141 /* the rand is from 0 to RAND_MAX */
142 return playlist_seed;
143}
144
145
146
147
131/* 148/*
132 * randomly rearrange the array of indices for the playlist 149 * randomly rearrange the array of indices for the playlist
133 */ 150 */
@@ -138,14 +155,14 @@ void randomise_playlist( playlist_info_t *playlist, unsigned int seed )
138 int store; 155 int store;
139 156
140 /* seed with the given seed */ 157 /* seed with the given seed */
141 srand( seed ); 158 seedit( seed );
142 159
143 /* randomise entire indices list */ 160 /* randomise entire indices list */
144 161
145 while( count < playlist->amount ) 162 while( count < playlist->amount )
146 { 163 {
147 /* the rand is from 0 to RAND_MAX, so adjust to our value range */ 164 /* the rand is from 0 to RAND_MAX, so adjust to our value range */
148 candidate = rand() % ( playlist->amount ); 165 candidate = getrand() % ( playlist->amount );
149 166
150 /* now swap the values at the 'count' and 'candidate' positions */ 167 /* now swap the values at the 'count' and 'candidate' positions */
151 store = playlist->indices[candidate]; 168 store = playlist->indices[candidate];