I am aware of the

ArrayList toEat = new ArrayList();
IPooledEnumerable eable = GetMobilesInRange(3);

foreach (Mobile m in eable)
{
[…]


But what if I wanted the mobile to pick a random target instead of "each of the mobile in range"?
I considered looking at tracking since its a similar system but I was wondering if someone had a better idea

Thank you!
 
Try something like this instead of foreach:

C#:
Mobile randomTarget = eable.RandomElementUsing<Mobile>(new Random())

This is untested, but the theory is sound.
 
Back