How to have random number with a packaged game?

Hello everyone !

I am making a procedural generated world. To do that, I am using FMath::RandRange(min, max). In the editor, every time I am playing, I get perfectly random numbers. But, when I package the game, it is always the numbers that are picked, and my game always look the same !
I think the problem is the seed of the number generator, but when I use srand(time(NULL)) I can’t compile or play the game in the editor !

This look like a bug from the engine so if you have any way to fix it, please, let me now !

Thank you !

You should merge to your engine code:

https://github.com/EpicGames/UnrealEngine/commit/edce4b6ff1b1c359d8fe156bccfc20c74af4b4fa

But if you can’t
use this:

uint32 Cycles1 = FPlatformTime::Cycles();
FMath::RandInit(Cycles1);
uint32 Cycles2 = FPlatformTime::Cycles();
FMath::SRandInit(Cycles2);

from the link.

Thank you very much now it works perfectly !