Skip to content

Instantly share code, notes, and snippets.

Created December 28, 2015 17:49
What would you like to do?
Como pero el sesgo de cada persona cambia con cada elección
#! /usr/bin/env python
import numpy.random as npr
for i in range(1, LOOP):
# Each person has a bias that changes in every poll
individual_bias = npr.randint(100000, size=SIZE)
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