about summary refs log tree commit diff homepage
path: root/brutalmaze/misc.py
diff options
context:
space:
mode:
Diffstat (limited to 'brutalmaze/misc.py')
-rw-r--r--brutalmaze/misc.py14
1 files changed, 1 insertions, 13 deletions
diff --git a/brutalmaze/misc.py b/brutalmaze/misc.py
index a5cb78a..fe09035 100644
--- a/brutalmaze/misc.py
+++ b/brutalmaze/misc.py
@@ -23,7 +23,7 @@ from datetime import datetime
 from itertools import chain
 from math import degrees, cos, sin, pi
 from os import path
-from random import shuffle, uniform
+from random import shuffle
 
 import pygame
 from pygame.gfxdraw import filled_polygon, aapolygon
@@ -87,18 +87,6 @@ def around(x, y):
     return chain(a, c)
 
 
-def choices(d):
-    """Choose a random key from a dict which has values being relative
-    weights of the coresponding keys.
-    """
-    population, weights = tuple(d.keys()), tuple(d.values())
-    cum_weights = [weights[0]]
-    for weight in weights[1:]: cum_weights.append(cum_weights[-1] + weight)
-    num = uniform(0, cum_weights[-1])
-    for i, w in enumerate(cum_weights):
-        if num <= w: return population[i]
-
-
 def play(sound, volume=1.0, angle=None):
     """Play a pygame.mixer.Sound at the given volume."""
     if pygame.mixer.get_init() is None: return