Einzelnen Beitrag anzeigen

Benutzerbild von STS301
STS301

Registriert seit: 6. Nov 2007
668 Beiträge
 
Delphi 7 Personal
 
#5

Re: Zufällige Eingabe erstellen

  Alt 19. Okt 2008, 19:45
es kann auch sein, dass es an Lazarus liegt
Delphi-Quellcode:
var
   SourceChars: String;
   resultString: String;
   anzahl: Integer;
   select: Integer;
   i: Integer;
   test: Integer;
begin
try
   test:= StrToInt(repeat1.text);
except
   exit;
end;

SourceChars := '';
if big.Checked then
  SourceChars := SourceChars + gross;
  
if small.Checked then
  SourceChars := SourceChars + klein;

If extra.Checked then
  SourceChars := SourceChars + sonder;
   
If number.Checked then
  SourceChars := SourceChars + zahlen;

if SourceChars = 'then begin
  ShowMessage('Please select the wanted properties!');
  exit;
end;

randomize;

resultString := '';
anzahl := StrToInt(repeat1.Text);
for i := 1 to anzahl do begin // !!!
  select := random(length(SourceChars)) + 1;
  resultString := resultString + SourceChars[select]; // besser als ständig in das Edit-Feld zu schreiben
end;
edit1.Text := resultString;
Sebastian

ölpölp

Linux will rule the universe!!
  Mit Zitat antworten Zitat