Properly obtain structure indexes and count and randomize them