delay() "does what it says on the tin" it delays the program until the delay is over.
So, you want to run 2 motors at random speeds and directions. You start motor 1 and delay() for a random time. Nothing else happens until the delay() is over so how do you start/stop motor 2 ?
The BlinkWithoutDelay example in the IDE shows how to use millis() to get the current time since the Arduino started and compare it with the elapsed time since an action, such as starting a motor, began. Only if the elapsed time exceeds the required period does the code do anything else, so it can move on to check other (different) elapsed times.
start motor1
save startTime1
define period1
start motor2
save startTime2
define period2
start of loop
if millis() - startTime1 >= period1
stop motor1
//other actions such as starting motor 1 again etc
end if
if millis() - startTime2 >= period2
stop motor2
//other actions such as starting motor 2 again etc
end if
end of loop
Code like this runs freely instead of stalling as it would using delay(). The actions when the periods elapse are up to you but if you start a new timed period remember to save the new start time.