Skip to content

Instantly share code, notes, and snippets.

View Blacklock's full-sized avatar

Blacklock Blacklock

  • Estonia
View GitHub Profile
@Blacklock
Blacklock / primrose-combos.py
Created February 20, 2019 14:55
Generates random setups for the Primrose mafia game.
import random
def weighted_choice(weights):
rnd = random.random() * sum(weights.values())
for i, w in enumerate(weights.values()):
rnd -= w
if rnd < 0:
return list(weights)[i]