Hi

Thats my solution. It isn't really fast, but that wasn't the target anyway:

| #!/usr/bin/ruby
| 
| def sample(members, max) 
|   results = []
| 
|   0.upto(max -1) do |nr|
|     nrs_available = (max - nr)
|     nrs_needed    = (members - results.length)
| 
|     # calculate the ratio between the needed members and the available nrs 
|     ratio = nrs_needed.to_f / nrs_available
| 
|     if (ratio + rand) >= 1
|       results << nr 
|     end
|   end
| 
|   return results
| end
| 
| members = ARGV.shift.to_i
| max     = ARGV.shift.to_i 
| 
| raise "MEMBERS must be smaller than MAX" unless members <= max
| 
| puts sample(members, max)

With 10 members and a max of 100 the script produces the following distribution
after 100K runs:
  http://rafb.net/paste/results/XCxeNI68.nln.html (distribution in percent)

Gruss
 Reto Schtel