 
 
 
6.8.5  Les nombres entiers aléatoires : rand alea hasard
rand a comme paramètre un entier n ou aucun paramètre.
- 
rand(n) renvoie un entier p aléatoire vérifiant 0 ≤ p<n.
 On tape :rand(10) On obtient par exemple :8 
- rand() renvoie un réel r aléatoire vérifiant 0 ≤ p<1.
 On tape :rand() On obtient par exemple :0.72392661823 
Remarque Il faut utiliser srand(n); (avec n un entier) ou srand; pour initialiser la suite des nombres aléatoires.
 
 
