Mathc initiation/Fichiers h : z r3


Sommaire



Installer ce fichier dans votre répertoire de travail.

z_r.h
/* ------------------------------------ */
/*  Save as :   z_r.h                   */
/* ------------------------------------ */

/* ------------------------------------ 
  Call :  time_t t;                                                            
            int i;                                                            
                                                                              
         srand(time(&t)); 
                                                             
            i = r_I(9);                                                    
   ------------------------------------ */
   
/* ------------------------------------ 
    positive and negative numbers  
   ------------------------------------ */
int r_I(
int maxI)
{
int x;

    x  = (rand() % maxI) + 1; /* + 1 : not zero */
    x *=  pow(-1,rand());

 return(x);
}
/* ------------------------------------ 
    positive numbers 
   ------------------------------------ */
int rp_I(
int maxI)
{
 return((rand() % maxI) + 1);  /* + 1 : not zero */
}
/* ------------------------------------ */
/* ------------------------------------ */


Ces fonctions nous donnerons des entiers aléatoires.

La valeur zéro a été neutraliser.