Re: RandomFrom problem: MathStrUtils not found

Posted by Jenny, DelphiLand Team on January 28, 2009

In Reply to RandomFrom problem: MathStrUtils not found posted by Phil Birell p16812 on January 26, 2009

: I want to use the function RandomFrom(ArrayOfStrings) in my program. I tried already to narrow the problem to the following simple program:

: procedure TForm1.Button1Click(Sender: TObject);
: begin
: ShowMessage(RandomFrom(['a', 'b', 'c']);
: end;
:
: ...but still Delphi gives an error:
:
: [Fatal Error] Unit1.Pas(8): File not found: 'MathStrUtils.dcu'
--------------------------

RandomFrom(SValues: array of string) is declared in the Delphi unit StrUtils. So you have to add this unit to the "uses" clause of each unit that uses this function.

Note 1: RandomFrom is not available in Delphi 4.
Note 2: Some Help files of Delphi 7 say that this function is declared in "MathStrUtils". That's wrong, it must be: "StrUtils".

Jenny, DelphiLand Team.

Related articles