Question : random number

how I can creat double random number?
I did this

 but thatone gives me integer random numbers.
I want numbers between 0 and 1

1:
2:
3:
4:
5:
6:
for (i=0; i<= noOfClients-1; i++){
	for (k=1; k<=noOfObjects-1; k++){
		lambda[i][k]=1+ (rand() % 1);
		printf("lambda[%d][%d]= %.lf\n",i,k, lambda[i][k]);
	}
}

Answer : random number

How is 'lamda' defined? If I do this I get a list of numbers between 0 and 1:

>       for ( int n = 0; n < 100; n++ )
>      {
>            double x = rand() / (double)RAND_MAX;
>            std::cout << x << std::endl;
>      }
Random Solutions  
 
programming4us programming4us