Minimum and maximum random numbers

Yes, this gives you random ranges that may also centered on red, which you said what you want. However, in some circumstances this may require a lot of extra handling after you return those values – for example, to lerp() to create a gradient, you can’t just move from one to the other, as this would proceed backwards across the wrong half of the range. For example, if you return [350, 30] and then lerp, you would want the halfway color = 10. But instead you get 190. It depends a lot on what your code that is checking these ranges wants to do. One way to handle it is to return an unwrapped start and end and not %360 until the very end – lerp(350, 390) and then %360 the result, giving you wraparound values. Another is to return split ranges and check the range length. So, if you will be drawing some colors or pixels, return either [180, 220] or return [350, 360, 0, 30]. Check the length of the return, and handle it as two ranges if it wrapped around.