From 45817ae8a45b6dcba07345bebf95581674bc1da8 Mon Sep 17 00:00:00 2001 From: "gasperfele@fri1.uni-lj.si" Date: Mon, 22 Dec 2014 16:44:53 +0000 Subject: 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 --- kpov_judge/kpov_random_helpers.py | 4 ++-- 1 file 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 -- cgit v1.2.1