I have a list of two digit integers and I'd like to randomize the order they are in. Right now they are appear like;
Int[0] = 10
Int[1] = 12
Int[2] = 4
Int[3] = 7
And I'd like them to randomize into something like;
NewInt[0] = 4
NewInt[1] = 12
NewInt[2] = 10
NewInt[3] = 7
Make a "set variable" action. Use the "random integer" function for each number and set between whatever amounts you want. I think that will work, but then again I am not very familiar with how arrays work.
Edit: I think that might just randomize the index numbers lol. I'm not sure how to manipulate the values for each index, but I'm going to assume you might so after the = you would probably wanna find the option that lets you change array index values then use the random integer function there.
I have a list of two digit integers and I'd like to randomize the order they are in. Right now they are appear like; Int[0] = 10 Int[1] = 12 Int[2] = 4 Int[3] = 7
And I'd like them to randomize into something like; NewInt[0] = 4 NewInt[1] = 12 NewInt[2] = 10 NewInt[3] = 7
What's the best way to do this?
@akaGrimm: Go
Make a "set variable" action. Use the "random integer" function for each number and set between whatever amounts you want. I think that will work, but then again I am not very familiar with how arrays work.
Edit: I think that might just randomize the index numbers lol. I'm not sure how to manipulate the values for each index, but I'm going to assume you might so after the = you would probably wanna find the option that lets you change array index values then use the random integer function there.
for each i from 1 to X
{
set placeA = random number from 1 to (array size)
set placeB = random number from 1 to (array size)
set tempint = myInt[placeA]
set myInt[placeA] = myInt[placeB]
set myInt[placeB] = tempint
}
This basically just swaps the values of two parts of your array around.
placeA, placeB, tempint are all integers.
X is how many times they are swapped; use a high value for a decent shuffle.