Procedural generated map is random in editor but not in packaged game

Hi,

I’ve created a game that generates a random map using C++ and the rand() functions and some algorithms. I use event beginplay to call my map generator at startup, and blueprints to spawn the assets.
This works great in the editor. The level is random every time I play.
However, when I package the game, the stand alone game will have the same level every time I launch the game.
If I re-package the game I will get a new static map.
Please help. I’m at a complete loss with this problem.

I’m just going to answer my own post here in case somebody else runs into this problem.
The reason for this behavior is because I did not use a seed for the random number generator. For some weird reason this will still give random numbers when run in the editor, but it will become static when packaged.
I added:
srand (time(NULL));
to the code and problem was solved.

Thanks to warlord57 for figuring this out.

For those of us who don’t understand code, how exactly do I add this into ue4?