Skip to content

Instantly share code, notes, and snippets.



Created Dec 28, 2015
What would you like to do?
Como pero cada persona tiene un sesgo que afecta a su elección
#! /usr/bin/env python
""" Execute it several times to vary the biases,
which can be biased too
import numpy.random as npr
# Each person has a given bias
individual_bias = npr.randint(100000, size=SIZE)
print individual_bias
for i in range(1, LOOP):
r = npr.randint(100000, size=SIZE)
# The uniformed distributed random is combined wth the individual bias
a = [1 if x > individual_bias[j] else 0 for j, x in enumerate(r)]
if sum(a) == TIE:
ties += 1
if i % 1000 == 0:
print("Total: {} ties: {} prob: {}".format(i, ties, ties/float(i)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment