rand() seeding with time() problem
问题 I'm having difficulty figuring out how to use rand() and seeding it with time() using Xcode. I want to generate random decimal numbers between 0 and 1. The code gives me seemingly random numbers for elements 1 and 2, but element 0 is always somewhere around 0.077. Any ideas why this would be? My code is: #include <stdio.h> #include <stdlib.h> #include <time.h> int main(void) { double array[3]; double rand_max = RAND_MAX; srand((int)time(NULL)); for (int iii = 0; iii < 3; iii++) array[iii] =