You have an example plugin in the topic, read it. It does what you want already. But, long story short: you need to initialize the random origin generator(obviously, can't use something that was not initialized) and then you can just retrieve the next available origin and use EngFunc_SetOrigin.
Also, feel free to ignore any warning you may get.
If you tried something, show the code. Saying "it does not work" is not helpful at all. How am I supposed(or anyone else) to know what you did wrong when you don't show what you did?