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}]
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}]
Here are a couple of approaches
RandomChoice[{-1, 1}, 10]
2 (RandomInteger[{0, 1}, 10] - 1/2)