Random function rejects if no directory is found