PHP 8.1.28 Released!

Random\Randomizer::getInt

(PHP 8 >= 8.2.0)

Random\Randomizer::getInt等確率に選ばれる整数を取得する

説明

public Random\Randomizer::getInt(int $min, int $max): int

警告

この関数は、 現在のところ詳細な情報はありません。引数のリストのみが 記述されています。

パラメータ

min

返される最小値。

max

返される最大値。

戻り値

閉区間 [min, max] の中から、 等確率に出るよう選ばれた整数値を返します。 minmax も返される値に含みます。

エラー / 例外

例1 Random\Randomizer::getInt() の例

<?php
$r
= new \Random\Randomizer();

// 範囲内の整数をランダムに出力します
echo $r->getInt(1, 100), "\n";
?>

上の例の出力は、 たとえば以下のようになります。

42

参考

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top