diff options
Diffstat (limited to 'src/consensus')
-rw-r--r-- | src/consensus/consensus-simulation.py.in | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/consensus/consensus-simulation.py.in b/src/consensus/consensus-simulation.py.in index 23639b195..39daf81c6 100644 --- a/src/consensus/consensus-simulation.py.in +++ b/src/consensus/consensus-simulation.py.in | |||
@@ -17,13 +17,9 @@ | |||
17 | # | 17 | # |
18 | # SPDX-License-Identifier: AGPL3.0-or-later | 18 | # SPDX-License-Identifier: AGPL3.0-or-later |
19 | 19 | ||
20 | from builtins import str | ||
21 | from builtins import range | ||
22 | from past.utils import old_div | ||
23 | import argparse | 20 | import argparse |
24 | import random | 21 | import random |
25 | from math import ceil, log, floor | 22 | from math import ceil, log, floor |
26 | from past.builtins import xrange | ||
27 | 23 | ||
28 | 24 | ||
29 | def bsc(n): | 25 | def bsc(n): |
@@ -40,7 +36,7 @@ def bsc(n): | |||
40 | 36 | ||
41 | def simulate(k, n, verbose): | 37 | def simulate(k, n, verbose): |
42 | assert k < n | 38 | assert k < n |
43 | largest_arc = old_div(int(2**ceil(log(n, 2))), 2) | 39 | largest_arc = int(2**ceil(log(n, 2))) // 2 |
44 | num_ghosts = (2 * largest_arc) - n | 40 | num_ghosts = (2 * largest_arc) - n |
45 | if verbose: | 41 | if verbose: |
46 | print("we have", num_ghosts, "ghost peers") | 42 | print("we have", num_ghosts, "ghost peers") |
@@ -106,4 +102,4 @@ if __name__ == "__main__": | |||
106 | sum = 0.0 | 102 | sum = 0.0 |
107 | for n in range(0, args.r): | 103 | for n in range(0, args.r): |
108 | sum += simulate(args.k, args.n, args.verbose) | 104 | sum += simulate(args.k, args.n, args.verbose) |
109 | print(old_div(sum, args.r)) | 105 | print(sum // args.r) |