<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def change_response(x, prob, index):
    '''
    change every response in x that matches 'index' by randomly sampling from prob
    '''
    #pdb.set_trace()
    N = (x==index).sum()
    #x[x==index]=9
    x[x==index] = dist.sample(N)