How can I make the first person character spawn at set locations in C++?

I want to spawn a character at random positions in the world. I have a function in C++ that generates the x,y,z coordinates randomly which sets the spawning location. I am using the First Person template provided by unreal engine in C++. How can I make the first person character to spawn at set locations?

Override this function in you GameMode, it is reponcible for spawning default pawn:

https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/AGameMode/SpawnDefaultPawnFor/index.html

In it spawn pawn in it and return it, use GetDefaultPawnClassForController (https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/GameFramework/AGameMode/GetDefaultPawnClassForController/index.html), to get default pawn class, or else you want pawn class to be hardcoded. As it BlueprintNativeEvent you need to override this function with _Implementation surfix. Look up how default code of this function looks like:

https://github.com/EpicGames/UnrealEngine/blob/dff3c48be101bb9f84633a733ef79c91c38d9542/Engine/Source/Runtime/Engine/Private/GameMode.cpp#L1278

You can also disable default spawn system by setting DefaultPawnClass in game mode to null and in BeginPlay of GameMode spawn pawn and make player controller possess it.

Thanks for you answer. Sorry I’m new to Unreal and still figuring out what you mean, and the third link you gave is broken. Can you explain how I can spawn the default pawn in BeginPlay of GameMode and make player controller possess it?