Hello,

I want to have some Randoms in my sprites move methods.

So the problem is if you say Random(10)=0 there,
on fast PCs it is happening more often than on slow PCs, cause higher FPS calls my move method more often.

I already have my sprites moving in dependency of time_elpased that is the time after the latest timer tick. time_elpased is>0 and <=1

time_elpase is a single;

if boolCounter then QueryPerformanceCounter(Current_Time)
else Current_Time := timeGetTime;
Time_Elapsed := (Current_Time - Last_Time) * Time_Scale;
if time_elapsed>1 then time_elapsed:=1;
So how must my random look like so it happens as often on slow PCs or fast PCs?

Something like this

if random(round(1/time_elapsed))=0 then happens each second

if random(round(2/time_elapsed))=0 then happens each 2 seconds

if random(round(0.1/time_elapsed))=0 then happens ten times a second

How is the best way that works for time_elapsed=1 but also for time_elapsed=0.001? Remember when it is 1 it is called 1 time a second, 0.001 would mean 1000 times a second, or am I wrong?

Thanks,
Firle