Steven Smith revised this gist . Go to revision
1 file changed, 1 insertion, 1 deletion
consensus.py
| @@ -2,7 +2,7 @@ import random | |||
| 2 | 2 | x = 0 | |
| 3 | 3 | v = "0" | |
| 4 | 4 | int1 = 1 | |
| 5 | - | int2 = 1000 | |
| 5 | + | int2 = inp | |
| 6 | 6 | random.seed() | |
| 7 | 7 | while x != 1000: | |
| 8 | 8 | v = v + "," + str(random.randint(int1,int2)) | |
Steven Smith revised this gist . Go to revision
1 file changed, 1 insertion, 1 deletion
consensus.py
| @@ -2,7 +2,7 @@ import random | |||
| 2 | 2 | x = 0 | |
| 3 | 3 | v = "0" | |
| 4 | 4 | int1 = 1 | |
| 5 | - | int2 = 2 | |
| 5 | + | int2 = 1000 | |
| 6 | 6 | random.seed() | |
| 7 | 7 | while x != 1000: | |
| 8 | 8 | v = v + "," + str(random.randint(int1,int2)) | |
Steven Smith revised this gist . Go to revision
1 file changed, 2 insertions, 2 deletions
consensus.py
| @@ -5,7 +5,7 @@ int1 = 1 | |||
| 5 | 5 | int2 = 2 | |
| 6 | 6 | random.seed() | |
| 7 | 7 | while x != 1000: | |
| 8 | - | v = v + " " + str(random.randint(int1,int2)) | |
| 8 | + | v = v + "," + str(random.randint(int1,int2)) | |
| 9 | 9 | x += 1 | |
| 10 | - | vlist = list(v) | |
| 10 | + | vlist = v.split(",") | |
| 11 | 11 | print max(set(vlist), key=vlist.count) | |
Steven Smith revised this gist . Go to revision
1 file changed, 1 insertion, 1 deletion
consensus.py
| @@ -5,7 +5,7 @@ int1 = 1 | |||
| 5 | 5 | int2 = 2 | |
| 6 | 6 | random.seed() | |
| 7 | 7 | while x != 1000: | |
| 8 | - | v = v + str(random.randint(int1,int2)) | |
| 8 | + | v = v + " " + str(random.randint(int1,int2)) | |
| 9 | 9 | x += 1 | |
| 10 | 10 | vlist = list(v) | |
| 11 | 11 | print max(set(vlist), key=vlist.count) | |
Steven Smith revised this gist . Go to revision
1 file changed, 3 insertions, 1 deletion
consensus.py
| @@ -1,9 +1,11 @@ | |||
| 1 | 1 | import random | |
| 2 | 2 | x = 0 | |
| 3 | 3 | v = "0" | |
| 4 | + | int1 = 1 | |
| 5 | + | int2 = 2 | |
| 4 | 6 | random.seed() | |
| 5 | 7 | while x != 1000: | |
| 6 | - | v = v + str(random.randint(1,4)) | |
| 8 | + | v = v + str(random.randint(int1,int2)) | |
| 7 | 9 | x += 1 | |
| 8 | 10 | vlist = list(v) | |
| 9 | 11 | print max(set(vlist), key=vlist.count) | |
Steven Smith revised this gist . Go to revision
1 file changed, 9 insertions
consensus.py(file created)
| @@ -0,0 +1,9 @@ | |||
| 1 | + | import random | |
| 2 | + | x = 0 | |
| 3 | + | v = "0" | |
| 4 | + | random.seed() | |
| 5 | + | while x != 1000: | |
| 6 | + | v = v + str(random.randint(1,4)) | |
| 7 | + | x += 1 | |
| 8 | + | vlist = list(v) | |
| 9 | + | print max(set(vlist), key=vlist.count) | |