RandomSample
RandomSample[ list, n ]
RandomSample[ list, n ] returns a list of length n with its elements randomly selected from list, where no element from list is chosen twice.
| Example | in | reduced |
|---|---|---|
The sample of 2 elements from the list {1,2,3,4,5}. |
RandomSample[ {1,2,3,4,5}, 2 ] |
{ 2, 5 } |