rand()
Hi,
I want to use random number.
But, the same random number is generated each time it is run.
When I debug the code below, W change with the same pattern every time I debug.
What's the problem and is there any solution to make random number which is not depend on the order?
/* USER CODE BEGIN 0 */
double uniform_rand(){
return (double)rand()/((double)RAND_MAX + 1);
}
/* USER CODE END 0 */
int main(void) {
/* USER CODE BEGIN 2 */
srand(time(NULL));
/* USER CODE END 2 */
while {
W = uniform_rand();
}
}

