wait, what does this do? generate a unique dir? Because good Math.random() behaviour is to possibly generate the same number many times in a row, and I don't see a check to test whether the dir already exists with a while(exists) { tryagain } pattern.