generate random number 0-1, when I type the input number less than 4, the code works fine. However when the input number above 4, the eclipse stop working. what's wrong with my code
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
double ran(double x0, double x1){
return x0+(x1-x0)*rand()/((double)RAND_MAX);
}
int main(void) {
int a,i;
double *b;
printf("input the size\n");
scanf("%d", &a);
b=(double*)malloc(sizeof(int)*a);
srand((unsigned)time(NULL));
for(i=0;i<a;i++)
{
b[i]=ran(0,1);
printf("\n %f", b[i]);
}
free (b);
return 1;
}