When using the "Random Integer in Range from Stream" where the seed is a power of 2 after a certain point (2^22) the random integer that is returned is the always the same. If the seed is 2^23 + 1 it will be different. This happens multiple times before overflow happens. Attached is an example project.

Found in 4.22.3 CL#7053642
Reproduced in 4.21.2 CL#4753647, 4.23 Preview 4 CL#7647024, 4.24 Main CL#7713815

Steps to Reproduce

1. Create a new blueprint.
2. Add a Random Stream variable.
3. In the Event Graph follow to a For Loop (Min 0, Max 31).
4. Take the index raise 2 to the power of the index and assign it as the new initial seed of your Random Stream variable.
5. Print out the seed and the output from "Random Integer in Range from Stream" using the Random Stream made earlier.

Result: Each call to "Random Integer in Range from Stream" returns a unique integer until 2^23.

Expected: The return integer from "Random Integer in Range from Stream" is unique.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-78521 in the post.

Login to Vote

Won't Fix
ComponentUE - Foundation - Core
Affects Versions4.
CreatedAug 7, 2019
ResolvedAug 27, 2021
UpdatedAug 27, 2021