rad2deg
<<<
rand round
>>>

6.51 Mathématiques
6 Index des fonctions
 Manuel PHP

Introduction
Pré-requis
Installation
Configuration à l'exécution
Types de ressources
Constantes Prédefinies
Abs
Acos
acosh
Asin
asinh
Atan
Atan2
atanh
base_convert
BinDec
Ceil
Cos
cosh
DecBin
DecHex
DecOct
deg2rad
Exp
expm1
Floor
fmod
getrandmax
hexdec
hypot
is_finite
is_infinite
is_nan
lcg_value
Log
Log10
log1p
max
min
mt_getrandmax
mt_rand
mt_srand
OctDec
pi
pow
rad2deg
->rand
round
Sin
sinh
Sqrt
srand
Tan
tanh

6.51.47 rand()Génère une valeur aléatoire

[ Exemples avec rand ]   PHP 3, PHP 4

int  rand ( int   min , int   max )

Appelée sans les options min et max , rand retourne un nombre pseudo-aléatoire entre 0 et RAND_MAX . Si vous voulez un nombre aléatoire entre 5 et 15 (inclus), par exemple, utilisez rand (5, 15) .

N'oubliez pas d'initialiser le générateur de nombres aléatoires avec srand .

Note

Dans les versions antérieures à la 3.0.7 la signification du paramètre max était longueur. Pour avoir le même résultat, il faut utiliser mt_rand (5, 11) pour obtenir un nombre aléatoire entre 5 et 15.

Voir aussi srand , getrandmax , mt_rand , mt_srand et mt_getrandmax .

<< rand >>
rad2deg Mathématiques round