{"name":"mod","operator":null,"title":"mod","type":"command","url":"https://community.bistudio.com/wiki/mod","revid":339102,"updated":"2023-04-26T10:54:26Z","groups":["Math"],"status":"ok","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Remainder of a divided by b.","syntaxes":[{"syntax":"a mod b","since":null,"effect":null,"exec":null,"params":[{"name":"a","type":"Number","optional":false,"default":null,"description":null,"types":["Number"],"since":null,"text":"a: Number"},{"name":"b","type":"Number","optional":false,"default":null,"description":null,"types":["Number"],"since":null,"text":"b: Number"}],"returns":{"type":"Number","types":["Number"],"description":null,"text":"Number"},"form":"binary","operator":null,"left":{"text":"a","types":["Number"]},"right":{"text":"b","types":["Number"]}}],"examples":[{"text":"```sqf\n_remaining = 5 mod 2; // returns 1, as 5 divided by 2 is 2 × 2 + 1\n```","code":["_remaining = 5 mod 2; // returns 1, as 5 divided by 2 is 2 × 2 + 1"]}],"multiplayer":null,"problems":null,"aliases":["a % b"],"see_also":["Math Commands","Operators","a % b"],"notes":[{"user":"Hoz","date":"2006-04-16T01:34:00Z","text":"- Remainder is calculated in real domain.\n- mod is identical to a % b\nYou can use mod to round a decimal number down to the nearest whole number. For example: If you wanted to use the command random to generate a whole number between 0 and 5, you could put this in a script:\n\n```sqf\n_rand = random 6;\n_num = _rand - (_rand mod 1);\n```\n\nIn A1, the new commands round, floor or ceil would be the easier way to round."}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: Math","Introduced with Operation Flashpoint version 1.00","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Take On Helicopters: Scripting Commands"]}