implementation of randomString helper