This is half programming and half math, but I need the math portion answered as I'm no good at it.
I have a list of 10 objects and am randomly selecting and object from that list. I need the "average" of that list to be chosen most often, but the "average" is the 6th item of the list. I need my probabilities to stay the same, but to be offset by +1. I can't just add 1 however, as that will cause an error if it attempts to choose the last object in the list +1 since it won't exist.
My current method is simply picking a random number from 0 (first index of array) through 9 three times, then dividing the result by 3. The probabilities are exactly as I'd like it, but obviously I'm getting the 5th object the most often instead of the 6th.
Thanks in advance for the answers, and if this is insanely simple I apologize for my horrendous math skills.
Here's a distribution over those numbers that has an expected value of $6$:
I will leave it to you to verify that the average will in fact be 6. To implement this distribution, do the following:
If you'd like a distribution in which 6 is the average and the most common, you can have a binomial distribution with $n=9$ and $p=\frac69=\frac2/3$. To program this distribution, you could do the following: