add common function for random strings and numbers