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
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.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-78521 in the post.
3 |
Component | UE - Foundation - Core |
---|---|
Affects Versions | 4.23, 4.21.2, 4.24, 4.22.3 |
Created | Aug 7, 2019 |
---|---|
Resolved | Aug 27, 2021 |
Updated | Aug 27, 2021 |