Question: I have a problem: There are $i$ betters, each choose a random value between [$0$ and $n-1$]

Then we add all the $i$ numbers and we do (mod $n$)

$$\text{Final number}= (\operatorname{rand}[0,n-1]+\operatorname{rand}[0,n-1]+\cdots+) \pmod n$$

Does the final number has the same odds to fall on every number in $[0 , n-1]$ or does it has more chance to fall on the first numbers of the range ($0,1,2,3,4,5,6,7,8,9,10,11,\ldots$ etc)

Answer: 
Your solution can work as well as many others, like e.g.

```
6v6/0 -> 2v2/2-> 1v1/0

```

where `XvY/Z` means *weight X against Y, keep the heavier of them if any, Z otherwise*.

Your solution has the merit to possibly require *less* weights in 2 cases out of 12, of course, although it can be improved a bit like this (I hope the notation for the arrow is self-explanatory):

```
3v3/6 -XY-> 1v1/1
      -Z--> 2v2/2 -> 1v1/0

```

which requires only two weights in half of the cases.

Note that you can use up to 2 weights if you have no more than 9 marbles, because you can solve 9 marbles as follows:

```
3v3/3 -> 1v1/1

```

So, another perfectly valid solution to the 12 marbles puzzle might even be:

```
2v2/8 -XY-> 1v1/0
      -Z--> 3v3/2 -XY-> 1v1/1
                  -Z--> 1v1/0

```

which requires only two weights in one third of the cases.

In general, if you have N weights at your disposal, you can solve the puzzle up to $3^N$ marbles included. With three weights, you can then have up to 27 marbles:

```
9v9/9 -> 3v3/3 -> 1v1/1

```

and it's basically the extension of a binary search with three alternatives instead: you can generally divide your lot into three partitions, and have a way forward by comparing only two of them.
You can solve three marbles in one weighing, knowing that one is heavier than the others. Weigh $1v1$.

If you have nine marbles, one heavier, you divide them into three threes. The first weighing identifies the rogue group, the second the rogue marble.

You can do twenty seven marbles with three weighings.

The logic of this is that the balance is either level or one of the two pans goes down. There are $27$ outcomes from three weighings.

If you know there is a dud marble, but don't know whether it is heavier or lighter, you can find the dud from thirteen marbles in three weighings - but you will only know heavier/lighter twelve times out of thirteen.