I'm writing a ranking algorithm and I would like to add randomness factor .
I'm generating a list of 10 items where each item has a value from 1 to 10 :
l = [random.randint(1,10) for num in range(1, 11)]
I'm running this code around 400 times and storing the large list in a DB .
I would like to add probability to it, so 70% of the times it generate radom numbers between 1 and 5 for the first 5 items, and 5 to 10 for the last 5 items .
And 30% of the times it stays random without any probability (normal mode) .
How can I achieve this using python and it's random module ?
Edit : Some thinks that this might be a duplicate of this question, however it' not, because I'm not looking to choose items based on a probabiltiy, instead I would like to be distributed based on their weight .