This question already has an answer here:

I want to teleport a player randomly in a 10,000 block radius when they step on a pressure plate. How do I do this?

marked as duplicate by greg-449, Schism, galacticninja, Wondercricket, Ivo Coumans Jul 29 at 12:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Have you made any attempt to solve this yourself? Arqade works better when askers show effort to solve their own problems; we see that you have a problem you've worked on, and answerers respond to that. You also get a more specific answer that's tailored exactly to the part you're stuck, and Arqade gets a very specific question. Everybody wins! – Frank Mar 7 '17 at 4:50

Try the /spreadplayers command, which spreads entities in a random area. The syntax is /spreadplayers <x> <z> <spreadDistance> <maxRange> <respectTeams> <player …>

In your case, you might want to try something like /spreadplayers ~ ~ 0 10000 false @a[r=5,c=1].

  • 1.13 syntax: @a[distance=..5,limit=1] – pppery Jul 14 at 0:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.