diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2002-06-04 21:50:45 +0000 |
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2002-06-04 21:50:45 +0000 |
| commit | d4c9173888e86582681bcb45a0fa8e397e83dbc8 (patch) | |
| tree | a80409e68e4553290b143e861b229a81e8891c0a | |
| parent | 4bf52eae14be82230f7aff9010003725e84ce3e3 (diff) | |
| download | rockbox-d4c9173888e86582681bcb45a0fa8e397e83dbc8.zip rockbox-d4c9173888e86582681bcb45a0fa8e397e83dbc8.tar.gz rockbox-d4c9173888e86582681bcb45a0fa8e397e83dbc8.tar.bz2 rockbox-d4c9173888e86582681bcb45a0fa8e397e83dbc8.tar.xz | |
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
| -rw-r--r-- | apps/playlist.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 60786f6..f0fa40b 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -128,6 +128,23 @@ void add_indices_to_playlist( playlist_info_t *playlist ) close(fd); } +static unsigned int playlist_seed = 0xdeadcafe; +void seedit(unsigned int seed) +{ + playlist_seed = seed; +} + +int getrand(void) +{ + playlist_seed += 0x12345; + + /* the rand is from 0 to RAND_MAX */ + return playlist_seed; +} + + + + /* * randomly rearrange the array of indices for the playlist */ @@ -138,14 +155,14 @@ void randomise_playlist( playlist_info_t *playlist, unsigned int seed ) int store; /* seed with the given seed */ - srand( seed ); + seedit( seed ); /* randomise entire indices list */ while( count < playlist->amount ) { /* the rand is from 0 to RAND_MAX, so adjust to our value range */ - candidate = rand() % ( playlist->amount ); + candidate = getrand() % ( playlist->amount ); /* now swap the values at the 'count' and 'candidate' positions */ store = playlist->indices[candidate]; |