Logic to determine the number of times an item to be repeated in a distribution

I ran the below code with parameter value = 4, 8 and 16 , to know if there is a logic to determine how many times an item gets repeated in the distribution using the number of iterations and weight or is it always random.

Using value = 4, output : array = 1 3 3 0
*I was expecting item 0 to appear more times as its weight is more compared to item 3. Don’t know the reason why item 3 is distributed more.
Using value = 8, output : array = 1 3 3 0 0 2 3 0
Using value = 16, output : array = 1 3 3 0 0 2 3 0 0 2 1 2 3 3 1 3

From above outputs it seems like a random distribution. Let us say, I want item 0 to be distributed 10 times. Is there any mathematical formula or logic to get item 0 to be distributed 10 times ?

class mem_tx;
rand bit [1:0] burst;

constraint burst_dist_c {
burst dist {0:=10, 1:=3, 2:=5, 3:=8};
}
endclass
/////////////////
module top;
parameter value = 4;
mem_tx tx;
bit [1:0] arr [] = new[value];
initial begin
   tx = new();
    for(int i=0;i<value;i++) begin 
        assert(tx.randomize());
        arr[i] = tx.burst;
    end
    $display("array = %0p", arr);
end
endmodule

In reply to rakesh2learn:

You need to research statistical combinations for a formula.

A simpler way to think of this is by tossing a coin N number of times, and expecting to get exactly 50%/50% heads and tails. If you toss a coin 4 times, there are 16 equally possible outcomes, but only 6 of those outcomes would be exactly 2 heads and 2 tails. So you have a 6/16(38%) probability of getting 50/50%. Surprisingly, if you increase the number of tosses, the probability of getting exactly 50/50 decreases (N=16 gives you a 20% probability of exactly 8 heads and 8 tails).

But if you average out the number of heads and tails for each set of tosses, it will approach 50% heads and tails.

In your test, the solver may be selecting an outcome that does fall in line with your expectations. What you need to do is repeat the test with meany seeds and look at distribution, or just increase the size of the array.