I'm working on a random number generator and a random street address generator. Here are the codes.
Random_number -
random_numbers = []
random.seed(r_seed)
random_numbers += [random.randint(low, high)
for i in range(number)]
Random_address -
streetnames = [...]
rdnames = [...]
random.seed(r_seed)
fake_address.extend([str(random.randint(1, 9999)) + ' ' +
streetnames[random.randint(0, len(streetnames)-1)] +
' ' + rdnames[random.randint(0, len(rdnames)-1)]
for i in range(number)])
These two code sections are parts of different functions. The random number generator works perfectly and it reproduces the same list of random numbers for a given seed in any machine the function is executed from.
However, the random address generator produces different list of addresses for consecutive runs of the function.
My guess is that the issue is related to the use of multiple randints in the random_address part but not sure.
Any suggestion/reference is appreciated.
Aucun commentaire:
Enregistrer un commentaire