def MetropolisAlphaSampling(J,B,alpha):   # Metropolis Sampling Algorithm for alpha
    alpha_mean=0.0                         # declare a variable which will add all values of alpha, after sampling
    alpha_collect=np.array([]) 
    for i in range(1,3000):                # run iterations till 3000
        a1=b.PalphaJB(alpha,J,B)
        alpha_new=b.Randomalpha(alpha)       # find alpha randomly
        b1=b.PalphaJB(alpha_new,J,B)
        acceptance_ratio=b1/a1               # find Acceptance Ratio, which is division of probabilities with new vs old values 
        if np.random.rand()<= acceptance_ratio: # if random number found is less than accepatance ratio then assign alpha to new alpha
            alpha=alpha_new
        alpha_collect = np.append( alpha_collect , alpha ) 
        alpha_mean+=alpha                    # add alpha values to alpha mean
    return alpha_mean/3000,alpha_collect                   # return mean values of alpha_mean