ceil is a default command.

This command:

random 2

will result in a value between 0 and 1.999999... but never 2 itself, so you'll get a bunch of variables with 0.34234 or 1.9343 or 0.1324124 or whatever. By using the ceil command in front of it you'll get either 1 or 2 exactly, it rounds up to the next highest integer. So that's why the

*ceil random 2 > 1* should get you a 50% chance in that condition.

In the first example on my website there I use this to randomly select a single unit in a Civilian PRESENT ONCE trigger:

thislist select floor(random count thislist)

You could run this from the init.sqf actually. The trigger example is great for the demo, but in MP you might end up with multiple bombers. So run from the init.sqf inside an isserver wrapper.

Here's what that select code is doing:

Since arrays count up from 0 to whatever, I use the floor command. It's the same as ceil but rounds down so a

*floor random 2* would result in 0 or 1. So what that codes says is "count the units in this trigger and pick one randomly".

It's basically 4 commands in one:

First we count how many units activate the trigger, lets say we end up with 5 units. This means thislist is an array with 5 units: [bob, joe, tom, moe, larry] or the numbers that represent each would be [0,1,2,3,4]

count thislist

Next we pick a random number from that count so the code would be:

random 5

That gives us a number between 0 and 4.9999 so we next use floor to bring it down to a useable number:

floor 4.993413

Which results in 4, so next we select the 4 value (which is actually the

*5th* unit) from the array:

thislist select 4

Which in this example means that "larry", our 5th unit or the select 4 of the thislist array would be our bomber.