# 抽奖一次少一个名额

class randomMachine(object):
    import random as rd
    def setWeight(self, weight):
        self.weight = weight
        self.chanceList = []
        for k, v in self.weight.items():
            for t in range(v):
                self.chanceList.append(k)

    def drawing(self):
        r = self.rd.randrange(0, len(self.chanceList))  # 随机数
        # print("随机数 : ", r)
        has_chow = self.chanceList.pop(r)
        # print(has_chow)
        return has_chow

    def graphicsUI(self):
        pass

    def start(self):
        pass


if __name__ == "__main__":
    test = randomMachine()
    test.setWeight({"中奖": 1, "不中奖": 100})

    for i in range(100):
        has_chow = test.drawing()
        print(has_chow)