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.
Thanks in advance
Steve
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.
Thanks in advance
Steve