johnwasser:
If the list of numbers to be excluded has a reasonable maximum length it is safer to allocate that list statically.
sure, but it shouldn't affect (in any meaningful way) your algorithm for generating a list of random numbers in a range which at the same time is excluding a subset of excluded values. You already have to exclude values which may have been previously selected, so further de-selecting from the subset of excluded values then becomes more-or-less trivial regardless of the size of the excluded values.
johnwasser:
I prefer not to use dynamic memory allocation on an embedded system unless necessary.
adding some boundaries (in the above example) would surely help (e.g. what happens as the set of excluded numbers approaches the entire set of numbers within the range? quite catastrophic at the limit).