Generate random code for ShortenedUrl, add factory method for ShortenedUrl