Hi friends,
I'm in the middle of a nice project but have some problems with the function slRandom.
The game will be about cards, it's an Argentinian practice.
I have this code for mix the cards.
Previusly I have defined, MAX_CARDS 40, false 0 and true 1.
The problem is the function slRandom does not change the seed, if I restart the console or emulator always show me the same values with the vector mazo_barajado[].
I cast the testNum to short, because, slRandom returns a FIXED value.
Any advice?
I'm in the middle of a nice project but have some problems with the function slRandom.
The game will be about cards, it's an Argentinian practice.
I have this code for mix the cards.
Previusly I have defined, MAX_CARDS 40, false 0 and true 1.
Code:
short mixCards()
{short index=0;
for (i=0; i < MAX_CARDS; i++)
{usado[i]=false;
mazo_ordenado[i]=i;
}
for (i=0; i < MAX_CARDS; i++)
{
do{
//index = (rand() % 40 );
testNum = slRandom() % MAX_CARDS;
index = (short) testNum;
}
while (usado[index]==true);
mazo_barajado[i] = mazo_ordenado[index];
usado[index]=true;
}
return true;
}
The problem is the function slRandom does not change the seed, if I restart the console or emulator always show me the same values with the vector mazo_barajado[].
I cast the testNum to short, because, slRandom returns a FIXED value.
Any advice?