To give an entry ‘weight’ you could enter it multiple times. Then all you need to do is shuffle the array…