float random_value(int min, int max)
{
float temp = rand() / (float) RAND_MAX;
return min + temp *(max - min);
}
I have this function, but it is not working in cooja, as it always output the same numbers over and over again, and I don't have the time.h library to make srand()
. So, how should I print different random float values in cooja?
I should write a c function float random_value (float min, float max)
that could be used to implement virtual temperature sensor that could be configured to generate values between min and max value.