- Thread starter Dinkaru
- Start date

As in

`irandom(1)`

?may you give an example?Either use irandom(1), or choose(true,false).

In GML any value higher than or equal to 0.5 is true, anything below that is false.

may you give an example?

GML:

```
variable = 1 // true
variable = 0 // false
variable = irandom(1) // true half the time, false half the time. Make sure you call randomize() once at the beginning of the game
variable = choose(true, false) //true half the time, false half the time
variable = choose(true, true, false) // True 2/3rd of the time, false 1/3rd of the time
variable = random(1) < 0.5 //True half the time, false half the time
variable = random(100) < 50 //true half the time, false half the time
```

Last edited:

variable = random(100) < 500 //true half the time, true half the time

Just like the recent staffing problems at my job - too many zeroes.

GML:

```
variable = irandom(1) == 1;
variable = irandom(1) ? true : false;
```

GML:`variable = irandom(1) == 1; variable = irandom(1) ? true : false;`

GML:

```
if (((irandom(1) == 1) == true) ? true : false)
{
return true;
}
else
{
return false;
}
```

... I'll just quietly edit that and blame it on nondescript distractions and stressors in my life.variable = random(100) < 500 //true half the time, true half the time

GML:`if (((irandom(1) == 1) == true) ? true : false) { return true; } else { return false; }`

`true`

is literally triggering, I prefer
GML:

`if (((irandom(1) == 1) == !false) ? !false : false){ return !false; }else{ return false; }`

`!false`

using `irandom(1) == 0`

or `irandom_range(1,2) == 2`

?