millis() to stop motor

if (millis() < 10000){

This will only work in the first 10 seconds after reset - is that what you intended?

randNumberDir = random(255); // random number from 0-[glow]254[/glow]