Fala Paulo, é o seguinte ->
Uma vez eu precisei de um procedimento que preenchesse um TStringList com os nomes dos arquivos dentro de uma pasta, então eu escreví o seguinte ->
CODE
function GetLocalFileList(Path : string; list : Tstrings) : cardinal;
var search : TSearchRec;
i : integer;
begin
if (path[length(path)] = '\') then delete(path,length(path),1);
list.Clear;
i:=findfirst(Path+'\*.*',$2F,search);
if (i <> 0) then
begin
result:=1;
findclose(search);
exit;
end;
if (search.Name <> '.') and (search.Name <> '..') then
list.Add(path+'\'+search.Name);
while true do
begin
if (findnext(search) <> 0) then break;
if (search.Name <> '.') and (search.Name <> '..') then
list.Add(path+'\'+search.Name);
end;
{ i:=0; while (i<=list.Count-1) do
begin
if directoryexists(list[i]) then list.Delete(i) else inc(i);
end;} //só para diretórios
findclose(search);
result:=0;
end;
Então você declara uma TStrings ->
CODE
var list : TStrings;
begin
list:=TStringList.Create;
.
.
.
Aí você passa como parametro a pasta onde estão as fotos e a lista ->
CODE
GetLocalFileList('C:\Mulheres\',List);
Aí utilize Random para escolher uma foto da lista ->
CODE
Randomize;
repeat
foto:=List[random(list.count)];
until ((uppercase(copy(foto,length(foto)-3,4))='.JPG') or (uppercase(copy(foto,length(foto)-3,4))= '.BMP'));
mas isso pode causar um loop infinito se não houverem imagens na pasta então é melhor passar um filtro na lista ->
CODE
i:=0; while (i<=list.Count-1) do
begin
if ((uppercase(copy(list[i],length(list[i])-3,4)) <> '.BMP') and
(uppercase(copy(list[i],length(list[i])-3,4)) <> '.JPG')) then list.delete[i] else inc(i);
end;
aí sim use ->
CODE
Randomize;
foto:=List[random(list.count)];
Eu acho que para assegurar que a lista contenha apenas arquivos e não pastas deve-se inserir a parte que está como comentario na função, não me lembro bem porque faz muito tempo que a escreví.
acho que é isso, qualquer coisa me avise.