Represent poker cards as numbers from 0 to 51. 0 to 12 - all hearts from 2 to Ace, 13 to 25 all diamonds and so on. Your goal is to write a function for each poker hand type which generates a random 7-card hand (as in Texas Holdem on the river), in which the best 5-card combination is of the target type. The output is a sequence of 7 numbers. So, your function accepts a number from 0 to 8, where 0 is a High Card poker hand type and 8 is a Straight Flush, and returns a sequence of 7 numbers which represent the hand.
Additional requirements:
The hand should be sampled uniformly from all the possible hands of the given type. For example, it's not ok to generate straight flushes which always end with Ace.
You can't use or generate any look up tables bigger then 1000 values. For example, it's not ok to generate all flushes and than select a random one from them.
Generating completely random sets of 7 cards and checking for the target type until it is found is not allowed. Basically your function should have defined upper time limit.