WOLFRAM COMMUNITY
Connect with users of Wolfram technologies to learn, solve problems and share ideas
Join
Sign In
Dashboard
Groups
People
Message Boards
Answer
(
Unmark
)
Mark as an Answer
WOLFRAM COMMUNITY
Dashboard
Groups
People
0
|
2951 Views
|
2 Replies
|
2 Total Likes
View groups...
Follow this post
Share
Share this post:
GROUPS:
Mathematica
Wolfram Language
Creating random list of specific length with no repetition.
Sadi Altamimi
Sadi Altamimi, Palestine Polytechnic University
Posted
11 years ago
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 wi
t
hout redandancy ?
Regards
POSTED BY:
Sadi Altamimi
Reply
|
Flag
2 Replies
Sort By:
Replies
Likes
Recent
0
Sadi Altamimi
Sadi Altamimi, Palestine Polytechnic University
Posted
11 years ago
It works
Thanks Sam
POSTED BY:
Sadi Altamimi
Reply
|
Flag
2
Sam Carrettie
Sam Carrettie, Freelancer
Posted
11 years ago
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
|
Flag
Reply to this discussion
in reply to
Add Notebook
Community posts can be styled and formatted using the
Markdown syntax
.
Tag limit exceeded
Note: Only the first five people you tag will receive an email notification; the other tagged names will appear as links to their profiles.
Publish anyway
Cancel
Reply Preview
Attachments
Remove
Add a file to this post
Follow this discussion
or
Discard
Group Abstract
Be respectful. Review our
Community Guidelines
to understand your role and responsibilities.
Community Terms of Use
Feedback
Enable JavaScript to interact with content and submit forms on Wolfram websites.
Learn how »