generating indices array