Random spawn for multiplayer Minecraft server

//ads -- adsterra.com -- native banner
?>
I want to know if there's a way I can set it so that on first join, a player gets teleported to a random location on the map automatically. Then if the player dies without having a home set, they are once again teleported to a random location but not if they have their home set.
What would be the best way to accomplish this? May it be through command blocks or plugins.
Thank you for your time.
Pictures about "Random spawn for multiplayer Minecraft server"



Do you always spawn at 0 0 in Minecraft?
If the spawn point is deemed unacceptable, a new, temporary spawn point will be selected (although the criteria for "unacceptable" is unknown). So you always spawn "somewhere" near the center of the map (0,0).How do you teleport to spawn in a Minecraft server?
Teleport to Player SpawnpointHow do you set a spawn area on a server?
There are 2 ways to change your spawn point:Griefing a Pay-to-Win Server's Spawn - SM (Part 2) (NO LONGER P2W!)
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: cottonbro, saeed, luis gomes, Steve Johnson