getRandomLocation

fun World.getRandomLocation(): @NotNull Location

Generates a random location within the valid world boundary and returns it.

This method selects random coordinates within the permissible range of a Minecraft world (-29,999,984 to 29,999,984 for x and z, and -256 to 256 for y) and retrieves the corresponding location after ensuring that the block exists within the world.

Receiver

The world in which the random location is to be generated.

Return

A random location within the world boundary.