Say I have y distinct values and I want to select x of them at random. What\'s an efficient algorithm for doing this? I could just call rand(
y
x
rand(
A little suggestion: if x >> y/2, it's probably better to select at random y - x elements, then choose the complementary set.