In Unreal Engine’s Blueprints, a “Random Integer” or “Random Float” node allows you to generate a random number within a specified range. This is particularly useful for creating variability and unpredictability in your game.
Integers are whole numbers without any decimal or fractional parts, like 1, 2, or -10. They’re used for counting items or representing quantities that can only be whole.
On the other hand, floats are numbers that can have parts after the decimal point, like 3.5, -0.25, or 1.75. They’re handy for things like measurements, money, or any situation where you need to be more precise.
Random Integer Example
The Random Integer node just generates a number between 0 and 1, but since it begins counting from 0, we input a value of 2 for it to output two integers, 0 and 1. To avoid bugs, we save this number in a variable.
Random Float Example
The default node for Random Float will only return a value between 0 and 1.
Use the node “Random Float in Range” to define your own range.
The Random Bool node will output a true or false value at random.