RandomInRange without repeat

Hello guys, I have this problem here, I found only 1 answer to this question but it is outdated (2016). So If you can help I would be thankful. This is the situation: I have while loop which is going until main variable is 0, under it there is random in range depending on difficulty and then there are tasks which it is going to do depending on the random number, each task ends with subtracting 1 from main loop variable so it loops again. Here is the problem: I don’t want the random to choose the same task more than once so I want the random in range to not repeat number it already chosen.
I can do variable for each task so when it’s done it will loop the random again but it would be ineffective because, more tasks done the more it would take to loop randomly between finished ones and unfinished ones.
So I was wondering if there is way to do it that if task is completed it would not be included in the random in range, so it wouldn’t choose the same number again.

image

Also I am not good with the integrated JavaScript, because I am learning python and so i didn’t even begin to learn to use it.

Thanks.

Hi! Not much time to think about it but Iyou could create an array to store the number tasks already done, and then put the randomizer in a while loop that repeats until the task number doesn’t exists in the array.

Hi… I was actually thinking about this but I don’t know how to create array without JS code

child variables.

event.1
event.2
event.3
etc.

you can remove the child, after using it.
Have your events structure twice, one for looping thru and do actions, and another as a seperate data base which you set your looping events to.