That's cool - from an algorithm point of view, probably the most important part (after you assess the relative chances of each horse anyway), is to make sure that your market totals about 115% - 130% (this will give a market similar to what most bookmakers offer and ensures that people can't back every horse in the race for various amounts and guarnatee themselves a profit - which is exactly what is possible if the total market is less than 100%).

So basically, from a programattical point of view you would want to come up with a probability for each horse winning and have these probabilities total between 115% and 130% for each race... so a six horse race might look something like this:

1. 33%

2. 10%

3. 45%

4. 2%

5. 5%

6. 25%

(Total = 120%)

To calculate the odds is then ((1/prob) - 1) "to 1"

... so we get

1. 33% = ((1/0.33) - 1) = 2 to 1

2. 10% = ((1/0.1) - 1) = 9 to 1

3. 45% = ((1/0.45) - 1) = 1.22 to 1

4. 2% = ((1/0.02) - 1) = 49 to 1

5. 5% = ((1/0.05) - 1) = 19 to 1

6. 25% = ((1/0.25) - 1) = 3 to 1

(you would then round the figures to the nearest 'sensible' odds... so 1.22 to 1 would become 5/4, 49/1 would be 50/1, 19/1 would be 20/1 etc. You will probaly need to create a lookup table that has common odds and percentages, compare your actual percentage to that in the table and read off the odds value - or something similar to that anyway)

The hardest part is coming up with the probabilities in the first place