System.StrUtils.RandomFrom

提供: RAD Studio API Documentation
移動先: 案内検索

Delphi

function RandomFrom(const AValues: array of string): string;

C++

extern DELPHI_PACKAGE System::UnicodeString __fastcall RandomFrom(const System::UnicodeString *AValues, const int AValues_High)/* overload */;

プロパティ

種類 可視性 ソース ユニット
function public
System.StrUtils.pas
System.StrUtils.hpp
System.StrUtils System.StrUtils

説明

配列から無作為に選択された要素を返します。

RandomFrom 関数は,AValues 引数として渡された配列から無作為に選択された要素を返します。C++ では,AValues_Size は,配列の最後の要素のインデックス(要素数より 1 小さい値)です。

乱数生成関数を初期化するには,Randomize の呼び出しを追加するか,または RandomFrom を呼び出す前に RandSeed 変数に値を割り当てます。

関連項目