Quick question regarding random floats

Hi!

I have a small question - is there any way to randomize a number and feed that number into different functions without storing it as a variable?

I tried doing it this way as a small experiment:

But that results in three different numbers getting printed:

Is there anyway to do it so those three functions gets the same random float?
Or do i need to first store it as a variable, and then call it into the functions?

I thought this is what ‘Streams’ was for but i guess not…

You can work with the seed, same seed same result

Hey, thanks for your answer.

So i tried giving the ‘random float’ function a determined seed value like so:

But the three print functions are still printing out different float values:
(Although the same three values every time because of the seed)

I want them to get and print the same float from the ‘Random Float’ function, preferably without having to store them as variables first since that would result in loads of variables for the thing im working on.

The reason the numbers are printing the same three every time is because you are resetting the seed every third time back to “1”. To get the same number for every single “print string”, you must either place the “set random stream seed” within each “Sequence” exec wire (so all three funnel into and then back out of the node, if that can be done - otherwise you’ll need three of those nodes too), OR you can use a variable to save the retrieved random number.

Regardless, you will have to get a random number with the same initialization every time you “get” a random number or “get the random number” and then save it for the other values you want to have the same resulting random number (with a variable).

Perhaps if you explained more clearly what it was you are trying to do, we could give you recommendations?

EDIT: Realized, what I just told you will inevitably give you the same “random” number every time. You will have to do what I suggested, but with an int seed that gets incremented after every press of the fire weapon button (that way each iteration of the three print strings will receive a different number that is universal between the three of them). Just add the increment as a fourth exec wire on the sequence.

set the random stream like …

49483-rnd.png

i made a srteange example, i get same output

Thanks for the answers guys!
Understanding how the random float function works will help me a lot!

thanks!