Q:

Extend a list with numbers that match initial bias

I have a list that essentially goes as such:
Dalc = [1,2,1,1,1,1,1,1,1,1,1,1,5,1,1,3,1,2,1,1,1,1,2.......]

It currently contains 395 elements, and I'm trying to extend it such that I keep the same percentage of 1's, 2's, 3's, 4's and 5's. Min = 1, Max = 5, and I initially did the following to try and extend the list past 10000 elements:
from random import randint

....

Dalc_add = []
dalc_max = max(Dalc)
dalc_min = min(Dalc)
i = 0

while i < 10000:
    Dalc_add.append(randint(dalc_min, dalc_max))
    i = i + 1

Dalc.append(Dalc_add)

What this gave was a list with the initial bias present for the first 395 iterations, but then after that the rest of the list looked like:
[1,5,3,2,3,1,4,2,4,5,2,5,3,2,1,3,4,2,1,3,3,4,1........]
A lot more 3, 4, & 5 present, and it completely messes up any statistical analysis I can perform. 
How do I extend the list as above, while also preserving the weights and biases present (with respect to frequency of occurrence) for the list values?

A:

You can use numpy.random.choice. This randomly samples from the original list. If you feed it the original list, you don't need to use weights:
import numpy as np

Dalc = [1,2,1,1,1,1,1,1,1,1,1,1,5,1,1,3,1,2,1,1,1,1,2]
new_choices = np.random.choice(Dalc, size=10000)
Dalc += list(new_choices)

