# Random none too random when called in quick succession

I'm making use of the 'Randomize' and 'Random()' calls.
However due to the nature of my code (generating a random number as part of a finite looping) the number returned appears to be constant.
If I loop for 10 iterations then the value returned by the 'Random' call is pretty constant.
If I extend the loop to something like 100 then I get similar blocks, ie. the first 20 returns are the same, the 21st differs but then matches returns 22 through 40, etc.
Reviewing the Delphi help files it indicates that the Random function makes use of a value obtained from the system clock - clearly this will remain pretty much a constant on a high-spec machine doing a dozen swift iterations.
How can I best work around this such that I get a truly random return value for each iteration in the loop ?
Any help would be appreciated.
Steve
###### Who is Participating?

Commented:
well i have to guess your code but I'd say your loop looks kind of this :

for i := 0 to 100 do begin
Randomize;
end;

That is a wrong usage u should use randomize only once like this:

Randomize;
for i := 0 to 100 do begin
end;

in my little test the first usage gives results exactly as u discribed, the 2nd one makes what we all expect of Ransom ;-)
0

Commented:
you could use a different randseed
0

Commented:
You could call Randomize on each iteration, although I suspect this might have a performance impact.
0

Commented:
I must say, that when i was making graph-making program, i crossed the same problem.
Changing the RandSeed won't help. Using RandG, makes too similar patterns, that on 3D-graph can be seen as waves.
I think the solution would be different algorithm.
0

Commented:
With RandG, the result was more random than with normal Random. And calling Randomize; only sets the RandSeed to systemClock (GetTickCount).
0

Commented:
StevenK: