In a program, I need to set a variable to a random value of either 0 or 1.
I can't figure out how to do it and Google has failed me.
|
In a program, I need to set a variable to a random value of either 0 or 1. I can't figure out how to do it and Google has failed me. |
||||
|
|
|
One easy method is to use
More information about Bash's With that simple construct you can easily build powerful scripts using randomness, like in this comic... |
|||
|
|
|
You could use
|
|||
|
|
|
How about:
Or even:
|
||||
|
|
|
The easiest way I found was to use |
|||
|
|