a % b
From Bohemia Interactive Community
Click on the images for descriptions
Introduced in
 Game:
 Operation Flashpoint
 Version:
 1.00
Description
 Description:
 Remainder of a divided by b.
Syntax
Examples
 Example 1:
4.5 % 3
Result is 1.5
Additional Information
Notes
Only post proven facts here. Report bugs on the feedback tracker. Use the talk page or the forums for discussions.
Add New Note  How To
Add New Note  How To
Notes
 Posted on 01:34, 16 April 2006
 Hoz

 Remainder is calculated in real domain.
 a % b is identical to mod
_rand = random 6; _num = _rand  (_rand % 1);
In A1, the new commands round, floor or ceil would be the easier way to round.
Bottom Section
 Posted on July 21, 2015  14:55 (UTC)
 SilentSpike

Be careful when dealing with negative numbers. The way a modulo operation treats negatives differs between languages. In SQF truncated division is used, hence:
12 % 10 = 2 12 % 10 = 2 12 % 10 = 2 12 % 10 = 2