random choice with replacement in python code example
Example 1: python choose sample from list with replacement
import random
random.choices(list, k = 4)
Example 2: numpy random choice
>>> np.random.choice(5, 3, p=[0.1, 0, 0.3, 0.6, 0])
array([3, 3, 0])