PHP - Funktion mt_srand()
Beispiel
Seed den Zufallszahlengenerator:
<?php
mt_srand(mktime());
echo(mt_rand());
?>
Definition und Verwendung
Die Funktion mt_srand() startet den Mersenne Twister-Zufallszahlengenerator.
Syntax
mt_srand(seed, mode);
Parameterwerte
Parameter | Description |
---|---|
seed | Optional. Specifies the seed value |
mode | Optional. Specifies the algorithm to use. Can be one of the following constants:
|
Technische Details
Rückgabewert: | Keiner |
---|---|
Rückgabetyp: | - |
PHP-Version: | 4+ |
PHP-Änderungsprotokoll: | PHP 4.2.0: Zufallszahlengenerator wird jetzt automatisch geseedet |
❮ PHP Math Referenz