/* Generate series of double precision floating point random numbers in the range of [0, x] Emad Arasteh October 24, 2019 */ #include #include #include int main() { /* upper bound variable */ double x; /* number of random elements */ int nr = 0; /* random floating point number */ double rand_x; int i; printf("Please specify upper bound for randomization: "); scanf("%lf", &x); printf("Please specify number of elements to randomize: "); scanf("%d", &nr); srand(time(NULL)); for (i = 0; i < nr; i++) { rand_x = ( (double)rand() / (double)(RAND_MAX)) * x; printf("Random number %d : %f\n", i, rand_x); } return 0; }