forked from expo/troggle
Django 1.7 mostly working. Big refactor so probably bugs
This commit is contained in:
14
utils.py
14
utils.py
@@ -1,14 +1,14 @@
|
||||
from django.conf import settings
|
||||
import random, re, logging
|
||||
from core.models import CaveDescription
|
||||
from troggle.core.models import CaveDescription
|
||||
|
||||
def weighted_choice(lst):
|
||||
n = random.uniform(0,1)
|
||||
for item, weight in lst:
|
||||
if n < weight:
|
||||
break
|
||||
n = n - weight
|
||||
return item
|
||||
n = random.uniform(0,1)
|
||||
for item, weight in lst:
|
||||
if n < weight:
|
||||
break
|
||||
n = n - weight
|
||||
return item
|
||||
|
||||
def randomLogbookSentence():
|
||||
from troggle.core.models import LogbookEntry
|
||||
|
||||
Reference in New Issue
Block a user