# -*- coding: utf-8 -*-
# 随机数生成类
# 作者: 陈磊
# 时间: 2019-10-21


import random
import string


class UtilsRandom(object):
    def __init__(self):
        # [chr(i) for i in range(65,91)] 大写字母
        # [chr(i) for i in range(97, 123)] 小写字母
        # [str(i) for i in range(1, 10)] 1-10数字
        self.library = [chr(i) for i in range(97, 123)] + [str(i) for i in range(1, 10)]

    def get_random(self, size):
        """
        :param size: 字符串长度
        :return: 返回随机字符串
        """
        num = random.sample(self.library, size)
        num_str = ""
        value = num_str.join(num)
        return value
