There's a few options:
1. Use modulo (rand % 28). This is kind of the "standard" way to range a random integer in higher level langauges or platforms where division is "easy". You will notice that it doesn't divide evenly: 256 / 28 = 9 R 4. However, all this means is that most results happen 9/256 times, and 4 of your results happen a slightly more often 10/256. The primary disadvantage here is that division is a relatively slow operation, but in a lot of cases not that big a deal. Sometimes an iterative subtraction loop is very practical, you don't necessarily even need an "optimized" divide. On the other end of the easy-to-implement spectrum you could also use a lookup table for very fast specific common division, at the expense of some ROM space.
2. Reroll if out of range. This has the unfortunate problem that it takes an unspecified number of iterations, but in practice it's generally mostly 1, rarely 2, almost never 3. If you're doing this make sure your random number generator is guaranteed to produce all values so you don't have the possibility of an infinite reroll.
There are some other options, like using an uneven distribution (e.g. add several power-of-two masked random values), but the two above are the most straightforward, I think.
Edit: ha ha ha 3 short posts covering both these options happened while I was explaining them.