Random String Generator

  • Share this:

Code introduction


Generates a random string of specified length, composed of letters and digits.


Technology Stack : random, string

Code Type : Function

Code Difficulty : Intermediate


                
                    
import random
import string
import os
import sys
import json
import math
import datetime
import re
import hashlib
import base64
import email.utils
import html

def generate_random_string(length=10):
    return ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(length))                
              
Tags: