copy implementation of gen_random_string into my own test case