6.8.4 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 entier p aléatoire vérifiant 0 ≤ p<231
(ou sur une architecture de 64 bits 0 ≤ p<263).
On tape :
rand()
On obtient par exemple :
846930886