implementation of random_string_map simplified