Reputation: 695
I have a simple question about randomly generating numbers in Octave/Matlab.
How do I randomly generate a (one!) number (that is either 0 or 1)?
I could really use an example.
Thanx
Upvotes: 4
Views: 13472
Reputation: 379
For the sake of variety, here's another way
floor(rand*2)
Upvotes: 1