Commit f6b78770 authored by Xuan Thang Nguyen's avatar Xuan Thang Nguyen
Browse files

fix modulo 0 during generation

parent 02e262b6
Loading
Loading
Loading
Loading
+10 −11
Original line number Original line Diff line number Diff line
@@ -192,7 +192,7 @@ double staggared(int size)
	int tmp=4096; //(RAND_MAX)/p; --> size=2048
	int tmp=4096; //(RAND_MAX)/p; --> size=2048
	int p= (size+tmp-1)/tmp;
	int p= (size+tmp-1)/tmp;


	const int VALUE = 16384/p; //(RAND_MAX)/p;
	const int VALUE = (1<<31)/p; //(RAND_MAX)/p;


	int i=1; int x=0;
	int i=1; int x=0;
	//the array of size N is split into 'p' buckets
	//the array of size N is split into 'p' buckets
@@ -205,7 +205,6 @@ double staggared(int size)


			if(i<=(p/2))
			if(i<=(p/2))
				min = (2*i -1)*VALUE;
				min = (2*i -1)*VALUE;

			else
			else
				min = (2*i-p-1)*VALUE;
				min = (2*i-p-1)*VALUE;
                
                
@@ -237,14 +236,14 @@ void start(ostream & out, string delim)
        vector<int> vec(size);
        vector<int> vec(size);


        out << "2^" << pow << delim;
        out << "2^" << pow << delim;
        out << fixed << setprecision(3);
        //out << fixed << setprecision(3);
        out << random(size) << delim;
        //out << random(size) << delim;
        out << shuffle(size) << delim;
        //out << shuffle(size) << delim;
        out << sorted(size) << delim;
        //out << sorted(size) << delim;
        out << almostSorted(size) << delim;
        //out << almostSorted(size) << delim;
        out << decreasing(size) << delim;
        //out << decreasing(size) << delim;
        out << gaussian(size) << delim;
        //out << gaussian(size) << delim;
        out << bucket(size) << delim;
        //out << bucket(size) << delim;
        out << staggared(size) << delim;
        out << staggared(size) << delim;
        out << zero_entropy(size);
        out << zero_entropy(size);
        out << endl;
        out << endl;