When generating a random number using FMath::RandHelper() in the constructor of an actor, attempting to print that same number on BeginPlay returns a different value than the constructor.
However, the value printed on BeginPlay will always be the same in each editor session. For example, if it prints 1 the first time, it will continue to be 1 each time you PIE until you restart the editor.
Found in 4.10.2 binary. Reproduced in 4.9.2 and Main CL 2826455
1. Open the editor
2. Create a C++ Actor Class
3. Add this code to the header
4. Add this code to the .cpp
5. In the editor, open the Output Log
6. Place an instance of the actor class in the level
Result: Constructor will print a randomized value to the output log each time you PIE, while BeginPlay will print a different value than the Constructor, but the same value as the first time you ran PIE during that editor session.
Expected: BeginPlay would print the same number as the constructor, and a different number each time you PIE.
Head over to the existing AnswerHub thread and let us know what's up.