Random number in range 1-6 to change value of one of other six nodes ?

I dont know how to link this, I want random number to change the second value of any of the six nodes displayed to 3
so they are all 1-4 and i want only one to become 1-3

it can stay like this because this should be Do Once action

I made this

how’s this? edit: wow you beat me quick @DImshvaebe

I will try it tommorow I made this but print result sometimes is 4 4 and it should never be 4 4 only 3 4. 4 3 and 3 3

In your case, the random integer on the far left is being evaluated 2 times. Once for the first print, and again for the second print. If you store it as a variable and then evaluate the math, you should get the results you want. Try my setup in the mean time, it should work as is.

I will but I dont understand what’s wrong with my setup. If random int is 1 then top equals one and triggers pick A on select int which is variable 3 and bottom is not equal 2 so then select int should pick B which is variable 4. If random int is 2 then top is not equal 1 and select int should pick B which is variable 4 and bottom is equal 2 then select int should pick A which is variable 3.

how comes sometimes both top and bottom are 3 or both top and bottom are 4 at the same time? this means random integer should give a result 1 and 2 at the same time in one case and in other case should give a number different than 1 or 2.

Am I triggering the random int two times? I tried to use a single randomizer that spreads into 6 places and gived random rotation to 6 different objects but everytime all of the 6 objects was rotating the same direction and never different of each other, so I think random integer spreading on 2 places is still giving same results in both places

Yup, 2 execution wires = 2 potentially different results as it’s evaluated twice. Store the random int in a variable first and only then us it. This would be consistent:

Thanks a lot I will do so. However I step into a next problem. Do you know any node that works as Random Int in Range excluding x. I can do it again with a variable and repeat random int node if number is same, but then I need to do it again and this time repeat if variable 1 and 2 are same, and next time with 3 and so on. Not a problem for 4 out of 6 numbers but if I have to do 500 times Random Int for 1-1000 numbers and on each new random int to exclude what was saved already and repeat there will be many repetitions and may cause lag.

random int in range excluding X will do great

This is what I mean, but if I have to do it multiple times it will cause lag

not ecactly this setup but u get the point

THIS is what I mean

You’re still not really using it correctly… notice how the wire goes *into *and *out *of the NewVar0 in my pic.

I don’t. What randomised pattern are you trying to generate? Why would it cause lag?

If you want to execute something N times, use a ForLoop. If you want to keep executing until a condition is met, you could opt for a While loop instead. Other than that, this is very unclear (to me) atm.

Create a pool of 1000 integers (a single loop), keep them in an array. Pick one at random and remove it from the array. This way it cannot be picked from that array again.

I think this should fix it, I didnt work with arrays so far but I will learn

Pressing 1 picks a value from the array at random and removes it from the array. It can never be selected again. (you may want to add an array bounds check here so you don’t exceed it) [HR][/HR]
Another way is to shuffle the array first. And then grab and remove the element at array’s Last Index, a much faster operation overall. Something along the lines of:


So the order of elements in the array is already randomised and you’re just taking the last one, trimming the array from the end. All results are unique / non-repeating and there’s no need to randomise anything else.

Thank you I will check them later. Look what i made, if I dont connect antything after Print String everytime I press the button one index disappears from the array, next time another index and after 6 clicks nothing is printed. So i wanted to refresh this after Print and everytime only 1 random index is removed then print whole array whithout that index and refresh again but it bugs and doesnt work at all

I just realize what I do with For Each Loop i didnt think about it I just saw it being used in another blueprint only to print the array list at once

I will try your options and save them too. So far I made this and if i modify it it will do the trick. This prints all numbers from 1 to 6 without one at random