Skip to content
Snippets Groups Projects
Commit 149ea829 authored by Steffen Friedrich's avatar Steffen Friedrich
Browse files

Given the min and max parameter ZipfianGenerator should not return 0 if (uz <...

Given the min and max parameter ZipfianGenerator  should not return 0 if (uz < 1) nor 1 if (uz<1.0+Math.pow(0.5,theta)). Instead it should return the min value (base) or min + 1.
parent 9c1c40fa
No related branches found
No related tags found
No related merge requests found
......@@ -276,12 +276,12 @@ public class ZipfianGenerator extends IntegerGenerator
if (uz<1.0)
{
return 0;
return base;
}
if (uz<1.0+Math.pow(0.5,theta))
{
return 1;
return base + 1;
}
long ret=base+(long)((itemcount) * Math.pow(eta*u - eta + 1, alpha));
......
package com.yahoo.ycsb.generator;
import org.testng.annotations.Test;
import static org.testng.AssertJUnit.assertTrue;
public class TestZipfianGenerator {
@Test
public void testMinParameter() {
long min = 5;
long max = 100;
Boolean gr_max = true;
ZipfianGenerator zipfian = new ZipfianGenerator(min, max);
for (int i = 0; i < 1000; i++) {
long rnd = zipfian.nextLong();
// System.out.println(rnd);
if(rnd < min) gr_max = false;
}
assertTrue(gr_max);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment