Ok let me try and explain this a bit better. I'm using a piece of software which will take a C header file and an obj file, import these as extra functionality and then it can call the functions these have defined so it's something like this.
Code:
INCLUDE(random)
while(not_eof)
{
call(random,"15")
go to next line
}
The 15 represents the maximum random number, now my header file looks like this
Code:
extern char* LB_Random(char*,char*);
And as you know my main code looks like this
Code:
char* LB_Random(char *maxR,char *dummy)
{
int i;
static char n[10];
int rMax = atoi(maxR);
rMax++;
i = rand() % rMax;
sprintf(n,"%d",i);
return n;
}
Seeing as you say I can only call srand once ever, what should I do. The only thing i can think of is defining another function in the above code that seeds during initialisation, and then calling the random function over and over. So something like
Code:
//Init
INCLUDE(random)
call(seed,"")
while(not_eof)
{
call(random,"15")
go to next line
}
How's that sound.