equal
deleted
inserted
replaced
23 |
23 |
24 from .. import ( |
24 from .. import ( |
25 encoding, |
25 encoding, |
26 error, |
26 error, |
27 node, |
27 node, |
28 pycompat, |
|
29 util, |
28 util, |
30 ) |
29 ) |
31 |
30 |
32 from . import ( |
31 from . import ( |
33 constants, |
32 constants, |
63 for i in iter_seed: |
62 for i in iter_seed: |
64 high_part = int_seed >> 35 |
63 high_part = int_seed >> 35 |
65 low_part = (int_seed & low_mask) << 28 |
64 low_part = (int_seed & low_mask) << 28 |
66 int_seed = high_part + low_part + i |
65 int_seed = high_part + low_part + i |
67 r = random.Random() |
66 r = random.Random() |
68 if pycompat.ispy3: |
67 r.seed(int_seed, version=1) |
69 r.seed(int_seed, version=1) |
|
70 else: |
|
71 r.seed(int_seed) |
|
72 # once we drop python 3.8 support we can simply use r.randbytes |
68 # once we drop python 3.8 support we can simply use r.randbytes |
73 raw = r.getrandbits(id_size * 4) |
69 raw = r.getrandbits(id_size * 4) |
74 assert id_size == 8 |
70 assert id_size == 8 |
75 p = struct.pack('>L', raw) |
71 p = struct.pack('>L', raw) |
76 new = node.hex(p) |
72 new = node.hex(p) |