Blueprints - Dealing with Random Numbers

Hi all,

I am doing some work using the Random Integer In Range node. I have the following code:

But it is giving me some strange results. What I think may be happening is that when SET A Variable is called, it is picking the random number, doing the timespan addition, and then setting the value. Then, when SET Another Variable is called, it is doing it again therefore picking a DIFFERENT random number.

Can someone who knows more about blueprints verify if this is the cause of my problem or not? If it is, what workaround could I use to ensure that both variables are being set based on the same random integer?

Many thanks in advance!

1 Like

Whilst I was waiting for an answer to this question I decided to try some tests for myself - and I fixed it! I made a struct to contain A Variable and Another Variable and that way, it was using the same random number for each. A note to any staff who may be reading this - I think that this shouldn’t be a problem! If a Get Random Number node has multiple outputs, it should pass the same output to each rather than executing Get Random Number multiple times. If it is possible to change I think it would save lots of time for many people.

1 Like