Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!
Difference between revisions of "rint"
From Quake Wiki
(New page: float '''rint'''(float ''val'') Returns ''val'', rounded up to the closest integer value.) |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | + | ''float'' '''rint'''(''float'' val) | |
− | + | == Usage == | |
+ | Rounds the passed number to the nearest whole number. | ||
+ | |||
+ | === Parameters === | ||
+ | *''val'' | ||
+ | :The number to round. | ||
+ | |||
+ | === Return === | ||
+ | Returns the rounded number. | ||
+ | |||
+ | == Example == | ||
+ | // Performs an action with a 50/50 chance | ||
+ | float chance = random(); | ||
+ | if (rint(chance)) | ||
+ | DoAction(); |
Latest revision as of 12:37, 1 August 2023
float rint(float val)
Contents
Usage[edit]
Rounds the passed number to the nearest whole number.
Parameters[edit]
- val
- The number to round.
Return[edit]
Returns the rounded number.
Example[edit]
// Performs an action with a 50/50 chance float chance = random(); if (rint(chance)) DoAction();