jeudi 24 octobre 2019

random choice selections are made with equal probability

I have a questions about random.choice of python i choose list have 8 elements. When i choice 120 millions, selections are not made with equal probability. Example: Number 1: 8M choiced, 2: 15M choiced ... When i read docs function

      If the relative weights or cumulative weights are not specified,
        the selections are made with equal probability.

Who can explain for me this trouble ?

python3.6

list_queues = ["{}_{}".format(queue_name, random.randint(1, i)) 
for i in range(1, 8)]
list_queues.append(queue_name)
queues.append(random.choice(list_queues))
for queue in queues:
  celery.send_task(name=queue_name, queue=queue, routing_key=queue, args=args)



Aucun commentaire:

Enregistrer un commentaire