outsourced threaded random to own function, removed code