procedure TForm1.Button2Click(Sender: TObject);
var
setb: set of Byte = [];
questionList: array[1..100] of string[12];
i: Integer;
idx: Byte;
questionSelection: array[1..20] of string[12];
s: String[12];
begin
for i := Low(questionList) to High(questionList) do
questionList[i] := 'Question ' + i.ToString; // questionList simulates your database of questions
Randomize;
i := 0;
repeat
idx := Succ(Random(100));
case (idx in setb) of
True: ;
False: begin
Include(setb, idx);
Inc(i);
questionSelection[i] := questionList[idx];
end;
end;
until i = 20;
Memo1.Clear;
for s in questionSelection do
Memo1.Lines.Add(s);
end;