i am using Python 3.8 and i am having the following problem in one of the functions i was trying to use.
from random import randint
def cross_(l, q):
k=randint(1,5)
for i in range(k,len(l)):
l[i],q[i]=q[i], q[i]
return l,q
off=[]
par_=[[1,0,0,1,0],[1,0,1,0,0]]
for i in range (0,4):
s, p = cross_(par_[0], par_[1])
off.append(s)
off.append(p)
The output is fine as long as i call the function once. but as soon as i call the function in a loop, it simply repeats the subsequent values as the same as that of the first call.
Why does it do that?