i'ma traying to get a random number between 0 and 1000000 in c language but when a run my program it return me a number 0.00000 and me i want a number between 0 and 1000000 here's the code
#include "procedure.h"
#include <stdlib.h>
void remplirTableauAvecEntiersAleatoires(int *tab,int taille,int valeurMax )
{
int i = 0;
srand(time(NULL));
for(i=0;i<taille;i++)
{
*(tab+i) = valeurMax + rand() / ((double)RAND_MAX / + 1);
printf("%f \n",*(tab+i));
}
}
Aucun commentaire:
Enregistrer un commentaire