summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2014-12-22 16:44:53 +0000
committergasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2014-12-22 16:44:53 +0000
commit45817ae8a45b6dcba07345bebf95581674bc1da8 (patch)
tree182b170ed6108f534469274d9d6bb87429843c30
parent310d84d2cb99bca6fb4a2e1c7372cf65a5345b78 (diff)
Fixed bug in kpov_random_helpers which should now be deterministic.
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@121 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
-rwxr-xr-xkpov_judge/kpov_random_helpers.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/kpov_judge/kpov_random_helpers.py b/kpov_judge/kpov_random_helpers.py
index 775bd69..ef6d68c 100755
--- a/kpov_judge/kpov_random_helpers.py
+++ b/kpov_judge/kpov_random_helpers.py
@@ -13,7 +13,7 @@ import glob
def alnum_gen(r, l=1):
s = u""
for i in xrange(l):
- s += random.choice(string.ascii_letters + string.digits)
+ s += r.choice(string.ascii_letters + string.digits)
return s
def fortune(r, max_len):
@@ -67,7 +67,7 @@ def IPv4_net_gen(r, min_hosts=254, local=True, multicast=False):
def IPv4_addr_gen(r, network, n_generated=1):
net, mask = _net_to_int(network)
hosts = []
- l = random.sample(xrange(1, 2**(32 - mask)-1), n_generated)
+ l = r.sample(xrange(1, 2**(32 - mask)-1), n_generated)
for i in l:
hosts.append(socket.inet_ntoa(struct.pack('>I', net | i)))
return hosts