diff --git a/utils.py b/utils.py index 920fcdf..967ffa4 100644 --- a/utils.py +++ b/utils.py @@ -1,3 +1,4 @@ +import sys import random import re import logging @@ -6,6 +7,13 @@ from django.conf import settings from django.shortcuts import render from troggle.core.models_caves import CaveDescription +def ChaosMonkey(n): + # returns True once every n calls - randomly + if random.randrange(0,n) != 0: + return False + # print("CHAOS strikes !", file=sys.stderr) + return True + def weighted_choice(lst): n = random.uniform(0,1) for item, weight in lst: