using random threhold to divide samples into bins