random_bytes 暗号学的にセキュアな、ランダムなバイト列を生成する &reftitle.description; stringrandom_bytes intlength ソルトやキーや初期化ベクトルのような、暗号化の用途に合った、 暗号学的にランダムなバイト列を任意の長さの文字列として生成します。 &csprng.sources; &csprng.function.backport; &reftitle.parameters; length 返すべきランダムな文字列の長さをバイト単位で指定します。 1 以上でなければなりません。 &reftitle.returnvalues; 暗号学的にセキュアなランダムなバイト列を含んだ文字列を返します。 &reftitle.errors; &csprng.errors; 不正な length が指定されると、 Error がスローされます。 &reftitle.changelog; &Version; &Description; 8.2.0 CSPRNG が失敗した場合に、 Random\RandomException をスローするようになりました。 これより前のバージョンでは、Exception をスローしていました。 &reftitle.examples; <function>random_bytes</function> の例 ]]> &example.outputs.similar; &reftitle.seealso; Random\Randomizer::getBytes random_int bin2hex