5

I am trying to get a set of random integers for which I used the function RandomInteger[{1, 50}, 5]. That way, however, there is the chance to get doubles such as {46, 7, 9, 39, 39}. How do I avoid numbers being drawn twice?

Thank you very much for your help

Sincerely

Tom
  • 213
  • 2
  • 7

1 Answers1

13

What you are searching is the function RandomSample

RandomSample[Range[50], 5]
halirutan
  • 112,764
  • 7
  • 263
  • 474