R образец () фанцент в Python
import numpy as np
np.random.choice(values, size=1000, replace=True, p=probability)
# values is the input values that correspond to the weights
# size is the number of samples to generate
# Replace specifies if it's with or without replacement
# p is the probability of choosing each corresponding value in values
Amused Ant