Timer / Delay


I’m fairly new to the BGE and python.
I’m making a basic prototype fish tank simulation for a university project. i.e. i want a cube to move in a random way around a tank (another cube), with some collision detection.

I want to get the box to move in a random way

My idea including questionable ‘pseudo’ code :

cont = GameLogic.getCurrentController()
move = cont.actuators[‘move’]
ob = cont.owner
sensor = cont.sensors[‘sensor’]

for i to 100
*activate actuator for 1 pulse
move.dRot = [random,random,random] #Rotate the with a random force
move.force = [random,random,random] #Move the object with a random (limited) force
*after random time (< x seeconds >) deactivate dRot and Force (or activate a force of [0,0,0]

My confusion:
I want this to start on game start.
I tried using always sensor. however this won’t work because it continually (pulses??) applies forces to the object i.e rotation and movement.
I would like to be able to control an individual pulse ( like pushing a keyboard key using the keyboard sensor ) from my python loop. However i’ve set gravity to 0 (to allow my cube move 360) meaning any movement i make is continual and will need to be stopped as well in the loop

My question:
I’d like to move/rotate for x seconds, then slow down, then continue in this nature for the duration of the loop. I’ve tried adding a timer property to the object. I know how to access the timer but can’t implement it or figure out how to get the object to stop. I also tried using a delay sensor and using it in the loop but i failed to get that to work as well.

I’ve been through the forum for hours but can’t figure it out

Any ideas (Don’t be afraid to be as critical as necessary)