I want to make an integer array of 20 in size, and i want each part of the array to have a number between 1 and 20, but none can have the same number. Does anyone have an idea of how to make a trigger that can randomize the variables in this fashion?
You could do it the other way around, and take one out at random as needed:
Setup:
Set Count = 20
For each Integer A from 1 to Count
- Set Array[Integer A] = Integer A
Get a number:
Set TempInteger = Random integer between 1 and Count
do something with Array[TempInteger]
Set Array[TempInteger] = Array[Count]
Set Count = Count - 1
Alternatively, randomize the order inside the array:
For each Integer A from 1 to Count
- Set Integer1 = Random integer between 1 and Count
- Set Integer2 = Random integer between 1 and Count
- Set TempInteger = Array[Integer1]
- Set Array[Integer1] = Array[Integer2]
- Set Array[Integer2] = TempInteger
Can you convert that pseudo-code into WE format so I can visualize it better? Also, is there code in JASS that can make a loop repeat until a condition is met? If so that could be an easy way to do it by causing the loop to repeat until the other integers in the array no longer matches any of the other numbers.
The purpose is that I am making a map with 20 minigames, like Skibi's, and I want to randomize the minigames, but I don't want any minigame to be replayed until all have been played.
I'm on a page about incorrect corrections, and spent the better part of like two hours trying to get someone to understand that -5^2 = -25, not 25, and then that post had comments get reposted because that group is self sustaining, and that person was in turn trying to explain what I just explained to them. And I'm taking that as a victory
I will be AFK for a couple of days you guys hold down the fort while I am gone. I will be checking in on my phone but that will severly limit me. Be back saturday!
I just got to watch the video because even though I was there I was trying to work out tech problems with the chat since I was the social media guy so I was distracted but check it out guys the video is super fucking great!