How to cover variable based on mask value

I have requirement to cover mask values (variable mask values like every alternate bits are one, or every 2nd alternative bits 1 and so on) to the input variable.

The problem with below code it wont differentiate with each mask value.


 covergroup cg_in31_with_mask with function sample ( bit [31:0] input_bit,int position, N);
   cp_input31: coverpoint position  iff(position%N==0) {
     bins in31_loc[]    = {[0:31]} iff(input_bit[position]==1);
     }
 endgroup

  function void write_inputd(T tr);
   
    input_bit = tr.input_bit_cov;
  
    N = $urandom_range(1,10);   
    $display("random position bit set %d",N);

    for(int i=0;i<32;i++)
      cg_in31_mask.sample(input_bit,i,N);
  endfunction


In reply to Asif P M:

It would help to show some example data points you want to sample, and the coverage you are expecting to collect.

In reply to dave_59:

I have a mask variable : 1010_1010_1010_1010_1010_1010_1010_1010 for N = 1
0010_0100_1001_0010_0100_1001_0010_0100 for N = 2 (the bit set position varies with the value of N ranges from 1 to 10.

Input bit vector input_bit which is also 32 bit vector.
I want to cover each mask values are occurred with the input pattern (input_bit). Here I have 10 mask values as N ranges from 1 to 10. Both input_bit and mask bit are 32 bit vectors.

Hope I have conveyed the requirement