The problem here is that entities die all the time which means that they have to be removed from the list and when many entities are targeting many entities, that becomes a very expensive operation, so my solution is not to actually remove the entities when they die. I gave them a simply property which determines if they are still alive. This means that I have to change the targeting logic. I cannot simply use rnd.Next(0,10) because it may select a dead entity and it would require me to select again and this can really become a problem if there are a large number of dead entities in the list. This can cause an indeterministic performance hit due to all the reselects.

My idea is to enumerate the list whenever a random target is requested and generate a random number on each iteration and if the number chosen is equal to a certain number and the entity selected is not dead then return it as a target. Now I was thinking of two ways. Both ways involve testing the entity's property to see if its still alive first and then generating the random number to determine if it should be chosen. My 1st idea is to use rnd.Next(0,1) and choose it if the number chosen is 1 which gives each each living entity a 50% chance of being chosen. Problem is that I suspect that entities higher on the list would get chosen more times than entities lower in the list hence not an even distribution. My 2nd idea is to use rnd.next(0,n) where n is the number of entities in the list, or I may use the number of living entities. This returns the original odds of each entity being chosen in the case of a list of 10 entities to 1 in 10. However, I suspect that a good number of times, no entity will be chosen in which case I will simply return the last one in the list which makes me suspect that the last entity will be chosen most of the time, hence not an even distribution.

I just want an idea of how I can use this method of iteration to get an even enough distribution. ]]>

Code:

`r=a*b*c/sqrt((a+b-c)(b+c-a)(c+a-b)(a+b+c))`

I have tested the formula several times, and it seemed to be accurate everytime, but I still don't understand why that is.. could someone help me understand this? How does this result in the radius? ]]>