from typing import Optional
from typing import List
import string
import random


def randomString(length: int, samples: Optional[List[str]] = None) -> str:
    """A random string is generated.

    Args:
        length: the size of string.
        samples: cumstomized letters for sampling. e.g., ['a', 'b'].
    """
    letters = string.ascii_lowercase
    if samples:
        letters = samples
    return ''.join(random.choice(letters) for i in range(length))