wrote working routine for simple random threshold with dictionaries