Hey guys :)
I need a little help with my random number generation for drop function.
So, here is the way i wrote it:
if(true) //if enemy 1 killed
{
chance = random_drop();
if(chance >= 73)
{
set_drop();
}
}
if(true) //if enemy 2 killed
{
chance = random_drop();
if(chance >= 73)
{
set_drop();
}
}
if(true) //if enemy 3 killed
{
chance = random_drop();
if(chance >= 34)
{
set_drop();
}
}
and here is rand:
inline int random_drop(void)
{
srand (time(NULL));
volatile short int zwrot = rand() % 100 + 1;
return zwrot;
}
The problem is that when enemy1 and enemy2 are killed at almost the same time they alway both drop item, any idea why it's like this or maybe any other way to get random number? or maybe it's just a really really really big coincidence every time? ;d