PHP funkce mt_srand().
Příklad
Nasaďte generátor náhodných čísel:
<?php
mt_srand(mktime());
echo(mt_rand());
?>
Definice a použití
Funkce mt_srand() nasadí generátor náhodných čísel Mersenne Twister.
Syntax
mt_srand(seed, mode);
Hodnoty parametrů
Parameter | Description |
---|---|
seed | Optional. Specifies the seed value |
mode | Optional. Specifies the algorithm to use. Can be one of the following constants:
|
Technické údaje
Návratová hodnota: | Žádný |
---|---|
Typ vrácení: | - |
Verze PHP: | 4+ |
PHP Changelog: | PHP 4.2.0: Generátor náhodných čísel se nyní nasazuje automaticky |
❮ PHP Math Reference