This is the calculator to distribute grid positions for kart racing. It uses so-called genetic algorithm to find fair starting positions, that is, when entrants are reasonably evenly spread overs the heats. That is, they have reasonably equal positions over the heats. For example, if you have 3 heats and number 1 (of 10 entrants) starts the heat 1 in 1st position, you expect him to be at the back and around the middle for the two next remaining heats.
Note that the number of possible grid positions is enormous - in combinatorics it is called permutation or ordered set, thus you can't find fairest grid positions by simply enumerating all of them. For example, there are 3628800 permutations of 10 elements, and much much more combinations of 3 (number of heats) from 3628800. Thus, you can only try to find fair enough solution using heuristic algorithms and genetic algorithm is one of them.
As you enter number of heats and number of entrants into the calculator below, it will generate a solution. You can estimate its fairness by checking the average positions of entrants. They should tend to average, for example, for 10 entrants, 1, 2, ..., 10, the average position is the position at the middle, so, it is 5.5. The closer the average position of each entrant to the 5.5, the better. If you don't like some particular solution, press Calculate once more, and the calculator will try to find another one.