Jim,
Actually, after rereading what you posted more carefully, I agree with you. You can obviously expand the approach I posted above to include 50000 samples:
Map[Permute[prices, #] & , RandomPermutation[Length[prices], 50000]]
but this would have the same duplicates as your approach and would be slower than what you posted.
I like your post best. I suppose you can always guarrantee no duplicates with:
DeleteDuplicates[ Table[RandomSample[prices, Length[prices]], {i, 50000}]]
and it is still very fast (although duplicates are unlikely).
Regards,
Neil
Good idea, Neil. If one needed exactly 50,000 samples with no duplicates, just sample somewhat more than 50,000, delete duplicates, and then just use the first 50,000.
How about
Permute[prices, RandomPermutation[Length[prices]]]
This gives only one permutation and no duplicates.
Just drop the use of Permutations.
Permutations
prices = {5.0, 4.8, 4.7, 4.0, 5.3, 4.1, 5.5, 4.7, 3.3, 4.0, 4.0, 4.6, 5.3, 3.0, 3.5, 3.9, 4.7, 5.0, 5.2, 4.6}; samples = Table[RandomSample[prices, Length[prices]], {i, 50000}];
Just a simple comment: Your method is obviously more efficient than the OP's. However, the resulting collection of permutations will probably contain duplicates. While Rubens method will not.
Re that small probability: It appears to be a birthday paradox problem, and if I set it up correctly the probability is around 5*10^(-10).
Not that you need my confirmation but, yes, that is a good way to set up the problem:
1 - 50000! Binomial[20!, 50000]/(20!)^50000 // N (* 5.13779*10^-10 *)
However, if you are seeing lots (or even one duplicate) when running the code, please buy a lotto ticket for me.