diff --git a/lamps/LampGroup.py b/lamps/LampGroup.py index f8fee97..493636b 100644 --- a/lamps/LampGroup.py +++ b/lamps/LampGroup.py @@ -41,10 +41,14 @@ class LampGroup: self.currentLampPtr -= 1 def toggleRandom(self, sleepTime): - random_lamp = random.choice(self.lamps) - random_lamp.activate() + count = random.randint(1,8) + random_lamps = random.choices(self.lamps, count) + for lamp in random_lamps: + lamp.activate() time.sleep(sleepTime) - random_lamp.deactivate() + for lamp in random_lamps: + lamp.deactivate() + def cycle(self): if self.currentLamp: self.currentLamp.deactivate()