Esempio n. 1
0
 def __init__(self, bot):
     ModuleBase.__init__(self, bot)
     self.name = "ModuleBaguette"
     self.users = userList.UserList()
     self.lines = lines.LinesSeqRnd("modules/resources/bag.txt")
     self.probabilityBag = Probability(self.RATE_BAG)
     self.probabilityNotBag = Probability(self.RATE_NOT_BAG)
Esempio n. 2
0
 def test_proba(self):
     rates = (
         0.25,
         0.5,
         0.75,
     )
     for rate in rates:
         p = Probability(rate)
         cnt = 0
         for i in range(self.N):
             if p.next():
                 cnt += 1
         self.assertAlmostEqual(cnt, self.N * rate, delta=self.N * self.DIFF)
Esempio n. 3
0
 def test_one(self):
     p = Probability(1)
     for i in range(self.N):
         self.assertTrue(p.next())
Esempio n. 4
0
 def test_zero(self):
     p = Probability(0)
     for i in range(self.N):
         self.assertFalse(p.next())