Message Boards Message Boards

0
|
2732 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Creating random list of specific length with no repetition.

Salam,
In order to create a list of random integers we can use the built in function RandomInteger[range, n] . The result of course conatins n elements in the specified range (with repetition). What is the best way to create such list without redandancy ?
Regards
POSTED BY: Sadi Altamimi
2 Replies
It works emoticon

Thanks Sam
POSTED BY: Sadi Altamimi
RandomSample[{a,b,c,...},n] never samples any of the a,b,c,... more than once. So this should work:
In[1]:= RandomSample[Range[100], 10]
Out[1]= {71, 53, 41, 11, 25, 73, 67, 52, 5, 74}
POSTED BY: Sam Carrettie
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract