update page now
Laravel Live Japan

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

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant