From d4c9173888e86582681bcb45a0fa8e397e83dbc8 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 4 Jun 2002 21:50:45 +0000 Subject: 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 --- apps/playlist.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'apps') 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 ) 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]; -- cgit v1.2.3