This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Or with a short list of possible values - 16 in your example - you can generate a complete list and "shuffle" it like a deck of cards. Then deal out the first "n" cards to get a random selection. Shuffling is kinda like:
This is common in card games and lottery number pickers. If your max might go into thousands, it would probably be slow.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi