I need to create a function that generates random arrays of integers between a and b, inclusive, where a and b define the range and M and N define the size of the output array. I've done something but it seems that it's not properly working and I don't know exactly how can I define the size of the output array, where exactly to put M and N.....Here it's my code:
import random
def Rand(start, end, num):
res = []
for j in range(num):
res.append(random.randint(start, end))
return res
# Driver Code
num = 10
start = 20
end = 40
print(Rand(start, end, num))
Aucun commentaire:
Enregistrer un commentaire