int	BDD_class::set_random_input_data(bool** mask_input_data){
	int i,j;
	random_device rd;	
	mt19937 gen(rd());
	//#pragma omp parallel for
//	for (int zj=0;zj<BSD_samples*parameter_input_bit_width;zj++){
//		int i = int(zj/parameter_input_bit_width);
//		int j = int(zj%parameter_input_bit_width);
	for (int i=0;i<BSD_samples;i++){
		if(i<parameter_io_file_lines){
			for(int j=0;j<parameter_input_bit_width;j++){
				mask_input_data[i][j] = file_inputs[i][j];
			}
		}else{
			for(int j=0;j<parameter_input_bit_width;j++){
				int zj = i*parameter_input_bit_width + j;
				int zi = 0;
				long randint;
				zi = j%30;
				if(zi == 0){
					randint = gen();
				}
				mask_input_data[i][j] = bool((randint >> (zi))%2);
			}
			
		}
	}
	return 0;
};

int	BDD_class::mask_random_input_data(int depth,bool* mask,int amount,bool** mask_input_data){
	int i,j;
	//#pragma omp parallel for
	for (i=0;i<amount;i++){
		for (j=0;j<depth+1;j++){
			mask_input_data[i][most_influence[j]] = mask[most_influence[j]];
		}
	}

	return 0;
};

int BDD_class::hash_simplify_list_function(bool* list, bool neg){

	int a = int(BSD_samples/1);
	int b = int(BSD_samples/2);
	int c = int(BSD_samples/3);
	int d = int(BSD_samples/4);
	int line_sum_a=0;
	int line_sum_b=0;
	int line_sum_c=0;
	int line_sum_d=0;
	for(int i=0;i<BSD_samples;i++){
		if(i<d){
			if(list[i]==!neg)
				line_sum_d += 1;
		}else if (i<c){
			if(list[i]==!neg)
				line_sum_c += 1;
		}else if (i<b){
			if(list[i]==!neg)
				line_sum_b += 1;
		}
		else if (i<a){
			if(list[i]==!neg)
				line_sum_a += 1;
		}

	}
	int line_sum = line_sum_d * 3 + line_sum_c * 5 + line_sum_b * 7 + line_sum_a;
	return line_sum;
}
int BDD_class::compare_simplify_list(int list_line_amount,bool* this_line,bool** simplify_list, int* hash_simplify_list, int hash_number){
	int which_list_number = -1;
	//return which_list_number;
	bool it_can_simplify  = 0;
	int i,j;
	bool it_can_simplify_here;
	which_list_number = -1;
	double early_stop_accuracy_node = 1 - (1-parameter_early_stop_accuracy)/double(4);
	if(early_stop_accuracy_node < 1 - double(1)/BSD_samples){
		if(parameter_early_stop_oneway){
			for (int i=list_line_amount-1;i>=0;i--){
				it_can_simplify_here = 0;
				int same_bit = 0;
				bool oneway_merge =1;
				if((hash_number < double(hash_simplify_list[i]) * early_stop_accuracy_node) || (hash_number > double(hash_simplify_list[i]) / early_stop_accuracy_node)){
					it_can_simplify_here = 0;
				}else{
					for(int j=0;j<BSD_samples;j++){
						if(simplify_list[i][j] == this_line[j]){
							same_bit += 1;
						}else if(!simplify_list[i][j] && this_line[j]){
							oneway_merge = 0;
							break;
						}
					}
					if(double(same_bit)/double(BSD_samples) > early_stop_accuracy_node)
						it_can_simplify_here = oneway_merge;
				}
				if(it_can_simplify_here){
					it_can_simplify   = 1;
					which_list_number = i;
					break;
				}
			}
		}else{
			for (int i=list_line_amount-1;i>=0;i--){
				it_can_simplify_here = 0;
				int same_bit = 0;
				if((hash_number < double(hash_simplify_list[i]) * early_stop_accuracy_node) || (hash_number > double(hash_simplify_list[i]) / early_stop_accuracy_node)){
					it_can_simplify_here = 0;
				}else{
					for(int j=0;j<BSD_samples;j++){
						if(simplify_list[i][j] == this_line[j]){
							same_bit += 1;
						}
					}
					if(double(same_bit)/double(BSD_samples) > early_stop_accuracy_node)
						it_can_simplify_here = 1;
				}
				if(it_can_simplify_here){
					it_can_simplify   = 1;
					which_list_number = i;
					break;
				}
			}
		}

	}
	else {	
		for (int i=list_line_amount-1;i>=0;i--){
			it_can_simplify_here = 1;
			if(hash_number!=hash_simplify_list[i]){
				it_can_simplify_here = 0;
			}else{
				for(int j=0;j<BSD_samples;j++){
					if(simplify_list[i][j] != this_line[j]){
						it_can_simplify_here = 0;
						break;
					}
				}
			}
			if(it_can_simplify_here){
				it_can_simplify   = 1;
				which_list_number = i;
				break;
			}
		}
	}
	return which_list_number;
};
int BDD_class::compare_simplify_list_neg(int list_line_amount,bool* this_line,bool** simplify_list,int * hash_simplify_list,int hash_neg_number){
	int which_list_number = -1;
	return which_list_number;
	bool it_can_simplify  = 0;
	int i,j;
	bool it_can_simplify_here;
	which_list_number = -1;
	if(1){	
		for (i=list_line_amount-1;i>=0;i--){
			it_can_simplify_here = 1;
			if(hash_neg_number!=hash_simplify_list[i]){
				it_can_simplify_here = 0;
			}else{
				for(int j=0;j<BSD_samples;j++){
					if(simplify_list[i][j] == this_line[j]){
						it_can_simplify_here = 0;
						break;
					}
				}
			}
			if(it_can_simplify_here){
				it_can_simplify   = 1;
				which_list_number = i;
				break;
			}
		}
	}
	return which_list_number;
};


