7.50 Mathématiques
7 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
|
7.50.42 mt_srand()Initialise une valeur aléatoire (meilleure méthode)[ Exemples avec mt_srand ] PHP 3>= 3.0.6, PHP 4
void
mt_srand (
int
seed
)
mt_srand
initialise une meilleure valeur
aléatoire avec
seed
.
Exemple avec mt_srand |
// initialisation avec des microsecondes function make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } mt_srand(make_seed()); $randval = mt_rand();
|
Note |
Depuis
PHP
4.2.0, il n'est plus besoin d'initialiser le générateur de nombres aléatoires avec
srand
ou
mt_srand
car c'est fait automatiquement.
|
Voir aussi
mt_rand
,
mt_getrandmax
et
srand
.
|