     RealType bin_range = (1. / 32.0);
     RealType bin_start =  (RealType) lane_id * bin_range;
 
+    states = &states[blockIdx.x];
     rho *= bin_range; // Warp Size
 
 #ifdef LOG_RANDOM_EVENTS

        unsigned int * seq = sequences + (seq_idx * sequence_width);

        // use all threads to generate random numbers
        event_bins[ tid ] = curand_poisson( &states[blockIdx.x], rho );
        __syncthreads();

#ifdef LOG_RANDOM_EVENTS

    return c;
}

template < class RealType, class IntType >
__device__ void fill_random_pool( curandStateMtgp32_t * state, volatile RealType * rands, RealType bin_start, RealType bin_width, IntType offset, IntType N ) {
    N += (!!(N & (THREAD_NUM - 1))) * (THREAD_NUM - (N & (THREAD_NUM - 1))); // pad N st N = 256 n; assumes THREAD_NUM = 2^{p}

    // over generate random numbers per bin
    // avoids branch divergence
    while(offset < N ) {
        RealType event = curand_uniform( state );

        rands[ offset ] = bin_start + event * bin_width;

        offset += THREAD_NUM;
    }
}

/**
 *  This version assumes that allele_list is organized into units of WARP_SIZE (32) alleles
