added test for the case when the treshold value equals the adc value
added test for the case when the treshold value equals the adc value
added the random threshold mode