哥们,试试:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TMySArray = array[0..95] of string;
TMyIArray = array[0..95] of integer;
TForm1 = class(TForm)
Button1 : TButton;
memo : TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
Function SetSort(Astr,Bstr : char) : string;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
memo.Lines.Text := SetSort('a','0');
showmessage(SetSort('a','0'));
end;
function TForm1.SetSort(Astr, Bstr: char): string;
var
i : integer;
ResultStr : string;
A : TMySArray;
B : TMyIArray;
begin
Randomize;
ResultStr := '';
for i := Low(A) to High(A)do
begin
B := Random(2);
if B = 0 then
A :=Astr
else
A :=Bstr;
ResultStr := ResultStr + A;
end;
Result := ResultStr;
end;
end.