Function for generating random strings.