Skip to content

Instantly share code, notes, and snippets.

@blha303
Created May 29, 2012 00:33
Show Gist options
  • Save blha303/2821879 to your computer and use it in GitHub Desktop.
Save blha303/2821879 to your computer and use it in GitHub Desktop.
consensus.py
import random
x = 0
v = "0"
int1 = 1
int2 = inp
random.seed()
while x != 1000:
v = v + "," + str(random.randint(int1,int2))
x += 1
vlist = v.split(",")
print max(set(vlist), key=vlist.count)
@Mause
Copy link

Mause commented Jun 14, 2012

What is this for?

@blha303
Copy link
Author

blha303 commented Jun 14, 2012

Generates 1000 numbers between int1 and int2, gets the most common number generated. 'Consensus' because it pretty much polls people asking for a certain answer.

@Mause
Copy link

Mause commented Jun 14, 2012

Ah, fair enough 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment