My little Delphi version..
But without the 'hold' feature.
Produces: Target string HELLO found after 22537965 attempts..
Code:
var
target, output: string; a: word; cnt: longint;
begin
target:='HELLO'; cnt:=0;
repeat
output:='';
for a := 0 to length(target)-1 do begin
output:=output+chr(65+Random(26)); inc(cnt);
end;
until target=output;
Label1.Caption:='Target string '+target+' found after '+IntToStr(cnt)+' attempts..';
end;
But without the 'hold' feature.
Produces: Target string HELLO found after 22537965 attempts..
![[Image: cinjin_banner_border.jpg]](https://images.weserv.nl/?url=oggtheclever.com%2Fcinjin_banner_border.jpg)