In Python:
random.choices(population=['A', 'B', 'C', 'D'],
weights=[3, 2, 5, 7])
https://docs.python.org/3/library/random.html#random.choices