How to generate random string of my list without duplication in python? i tried using random.sample but it keeps sending me duplicates sometimes.
import random
column_arr = ['id', 'name', 'location', 'duration'
, 'id', 'name', 'quantity', 'unit'
, 'id', 'description', 'unit', 'quantity', 'unit_cost']
arr = []
for i in range(3):
arr.append(random.choice(column_arr))
print(arr)
Aucun commentaire:
Enregistrer un commentaire