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
This commit is contained in:
Daniel Stenberg 2002-06-04 21:50:45 +00:00
parent 4bf52eae14
commit d4c9173888

View file

@ -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];