getRandomLocationInLocationArea

fun getRandomLocationInLocationArea(location1: Location, location2: Location): Location

Generates a random location within a rectangular area defined by two corner locations.

The area is determined by the two given locations (location1 and location2), which represent opposite corners of a cuboid in 3D space. The resulting random location is inside the bounds defined by the minimum and maximum x, y, and z coordinates.

Return

A random Location object within the specified area, retaining the world of the first provided location (location1).

Parameters

location1

One corner of the location area.

location2

The opposite corner of the location area.