One random number generator code is as follow:
#include<stdio.h>
#include<stdlib.h>
int RandomNumberGenerator(int min_num, int max_num);
int main(void) {
printf("Min : 1 Max : 30 %d\n",random_number(0,5));
printf("Min : 100 Max : 1000 %d\n",random_number(100,1000));
return 0;
}
int RandomNumberGenerator(int min_num, int max_num)
{
int result=0,low_num=0,hi_num=0;
if(min_num<max_num)
{
low_num=min_num;
hi_num=max_num+1; // this is done to include max_num in output.
}else{
low_num=max_num+1;// this is done to include max_num in output.
hi_num=min_num;
}
srand(time(NULL));
result = (rand()%(hi_num-low_num))+low_num;
return result;
}
Put it into the CCS 5.2.1 with RM46 core,
the error messages appear as following:
"#10192 Failed linktime optimization"
"symbol "time" redeclared with incompatible type:"
When changing the time function to clock
like as "srand(clock(NULL));", the error exists still.
How to do this?
Thanks.