def partial_shuffle(x, d):
    """
    x: data to shuffle
    d: fraction of data to leave unshuffled
    """
n = len(x)
dn = int(d * n)
indices = list(range(n))
random.shuffle(indices)
ind_fixed, ind_shuff = indices[dn:], indices[:dn]
result = x[:]
for src, dest in zip(ind_shuff, sorted(ind_shuff)):
    result[dest] = x[src]
return result
разная степень перетасовки с использованием случайного модуля python