zipf: cleanup
authorJens Axboe <axboe@kernel.dk>
Wed, 7 Nov 2012 15:12:43 +0000 (16:12 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 7 Nov 2012 15:12:43 +0000 (16:12 +0100)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
lib/zipf.c

index 8cd25864792ba185320077a9e7619ef2a3360d35..21aaa36b1910655ccda093053a03470988736a8d 100644 (file)
@@ -99,21 +99,16 @@ static void shared_rand_init(struct zipf_state *zs, unsigned long nranges)
 
 void zipf_init(struct zipf_state *zs, unsigned long nranges, double theta)
 {
-       unsigned int i;
-
        shared_rand_init(zs, nranges);
 
        zs->theta = theta;
-
-       for (i = 1; i <= 2; i++)
-               zs->zeta2 += pow(1.0 / (double) i, zs->theta);
+       zs->zeta2 = pow(1.0, zs->theta) + pow(0.5, zs->theta);
 
        zipf_load_gen_zeta(zs);
 }
 
 unsigned long long zipf_next(struct zipf_state *zs)
 {
-
        double alpha, eta, rand_uni, rand_z;
        unsigned long long n = zs->nranges;
        unsigned long long val;