You could even do x[direction] += rand([-1, 1]). The allocation can be 
avoided by defining a global constant with [-1, 1] as its contents.

On Saturday, September 24, 2016 at 6:54:47 PM UTC-4, Steven G. Johnson 
wrote:
>
>
>
> On Saturday, September 24, 2016 at 6:09:14 PM UTC-4, David P. Sanders 
> wrote:
>>
>> julia> if rand() < 0.5
>>
>
> You can also do "if rand(Bool)"
>

Reply via email to