Random Spawn Help

I’m trying to make a gamemode that would put the players on a random position in a given map, but I don’t know how to prevent them from being spawned outside the boundries. Is there an easy way to do this, or should I just rely on default spawns?

Well… you can pick a random number for X, Y, Z and then check if it’s within map with this:

But I think there was a function that was returning map size/bounds, just can’t find it