10.03.2015, 13:18
Quote:
Thats almost exactly what I had, but wouldn't you subtract from rand? Doing so would remove the need to loop back to index one.
|
An iterator could look like that (it is sorted ascending)
array[sizeof array] = 3 (Iter_First), array[3] = 5, array[5] = 7, array[7] = sizeof array [thats the end]
It is a one way ticket, it is better to use Iter_Next which is just "array[value]"
Actually I think we should use Iter_Begin instead of Iter_First, as we want the first index not the first value
pawn Код:
new rand = Iter_Random(Frontier[0]));
if(Iter_Next(Frontier[0], rand) == Iter_Size(Frontier[0])) {
rand = Iter_Begin(Frontier[0]);
}
RandomCell[0] = Iter_Next(Frontier[0], rand);
RandomCell[1] = Iter_Next(Frontier[1], rand);