You could do something like this:
var dir = true
if randi() % 2:
dir = false
On the other hand, if you're looking for a random rotation direction, then what you really want is either 1
or -1
, which you can get if you raise -1
to a random power of 0 or 1.
var random_dir = pow(-1, randi() % 2)