updated contents from Atlas repo

This commit is contained in:
Luciano Ramalho
2014-10-14 14:26:55 -03:00
parent 40688c038d
commit 981d5bc473
157 changed files with 71134 additions and 1 deletions

24
interfaces/lotto.py Normal file
View File

@@ -0,0 +1,24 @@
import random
from tombola import Tombola
class LotteryBlower(Tombola):
def __init__(self, iterable):
self.randomizer = random.SystemRandom() # <1>
self.clear()
self.load(iterable)
def clear(self):
self._balls = []
def load(self, iterable):
self._balls.extend(iterable)
self.randomizer.shuffle(self._balls) # <2>
def pop(self):
return self._balls.pop() # <3>
def loaded(self): # <4>
return len(self._balls) > 0