[Django]-F() Expression strange behavior with Django

4👍

random.choice does not guarantee to produce non-repeating items.

import random

random_camps = random.sample(current_campaigns, amount)

is the way to go here.

Update
If you’re worried about the speed, this question addresses quick random row selection in postgres.

👤axil

Leave a comment