[vJASS] Pick X unique random numbers from 1 to N without brute force

Here is my code for getting maxNumbers unique random numbers from 0 to maxIndex. It usually works however I wonder if there is a way to do this without brute force?
JASS:
        local integer count=0
        local integer rand
        loop
            set rand=GetRandomInt(0,maxIndex)
            if not chosenIndexes.exists(rand) then
                set chosenIndexes.boolean[rand] = true
                //dostuff
                set count = count + 1
            endif
            exitwhen count >= maxNumbers
        endloop
        call chosenIndexes.flush()
 
Solved thanks

JASS:
        local integer count=0
        local integer rand
        local integer topindex=maxIndex
        local integer temp
        local integer i=0
        loop
            exitwhen i > maxIndex
            set abilityListShuffled[i] = abilityList[i]
            set i = i + 1 
        endloop
        loop
            set rand=GetRandomInt(0,topindex)
            //dostuff
            set temp=abilityListShuffled[topindex]
            set abilityListShuffled[topindex]=abilityListShuffled[rand]
            set abilityListShuffled[rand]=temp                    
            set topindex=topindex - 1
            set count = count + 1
            exitwhen count >= numSpells or topindex < 0
        endloop
 
Top