sampling chain function implemented