Way to randomize some numbers but not others?

Out of curiosity, is there a way to randomize numbers but instead of getting a number from A to B (0 to 5, for example) you get a number either from A to B or C to D (0 to 5, or 10 to 15, for example)?

Has been answered over here