How can I make a Random Range with a break in the middle?

I’m trying to make a spawn manager for enemies. The player is locked at 0,0,0, and I’m trying to make it so enemies can’t spawn within 10 blocks of the origin. To put it more simply I guess, I’m trying to make the spawn range -20 → -10, 10 → 20. for both the x and y plane.

Is there a way to use a Random Range or another formula to do this?

Write a function that does the following:

  • Get random number in range 10 to 20
  • Get random number in range -1 to 1
  • Get sign of 2nd number using Mathf.Sign
  • Multiply first number by this sign
  • Return the value

Call the function twice, once for x, once for y. Job done!