I use Randomize() ;
and then run Random() ; several times in a loop
the only trouble is that each time I run the program the output is the same each pass through the loop..
ie... it's supposed to output a random number on each of three passes through the loop...
it's actuall..
Code:
CODE
function RandomFunction(): Integer;
var
x: Integer
begin
x := Random(12) + 1;
Result := x;
end;
procedure Main;
var
i: Integer;
begin
Randomize();
for i := 1 to 3 do
showmessage(IntToStr(CallMyFunction()));
end;
var
x: Integer
begin
x := Random(12) + 1;
Result := x;
end;
procedure Main;
var
i: Integer;
begin
Randomize();
for i := 1 to 3 do
showmessage(IntToStr(CallMyFunction()));
end;
so... it'll output 4 three times, and then i'll run it again and it'll output 7 three times... grrrrr
i'm pretty sure i remember something about the Randomize() function being linked to the system clock, but I don't remember how... or necessarily all the implications of it... though I do remember that I'm not supposed to call it in the loop...
thanks,kvarnerexpress

