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
|
2949 Views
|
1 Reply
|
4 Total Likes
View groups...
Follow this post
Share
Share this post:
GROUPS:
Wolfram Language
Statistics and Probability
Random Interger
Sandra Deckel
Sandra Deckel
Posted
11 years ago
Hi I am trying to create a random list of only -1 and 1. I am only need 10 digits, I don't want any zeroes. I have tried to use mathematica to omit 0's with the if command but that doesn't work.
H = Table[RandomInteger [{-1}, {1}], {i, 0, 10}]
POSTED BY:
Sandra Deckel
Reply
|
Flag
1 Reply
Sort By:
Replies
Likes
Recent
4
David Reiss
David Reiss, Scientific Arts
Posted
11 years ago
Here are a couple of approaches
RandomChoice[{-1, 1}, 10]
2 (RandomInteger[{0, 1}, 10] - 1/2)
POSTED BY:
David Reiss
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 »