BIS fnc randomNum: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
(Fix incorrect inclusive/exclusive)
 
(30 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Function|Comments=
{{RV|type=function
____________________________________________________________________________________________


| arma2 |Game name=
|game1= arma2
|version1= 1.00


|1.00|Game version=
|game2= arma2oa
|version2= 1.50


|gr1 = Math |GROUP1=
|game3= tkoh
____________________________________________________________________________________________
|version3= 1.00


| Returns a random (float) number between the two passed numbers (inclusive). The order of parameters doesn't matter: it can be {{Inline code|[min, max]}} or {{Inline code|[max, min]}}. |DESCRIPTION=
|game4= arma3
____________________________________________________________________________________________
|version4= 0.50


| [min, max] call [[BIS_fnc_randomNum]] |SYNTAX=
|gr1= Math


|p1= min: [[Number]] - minimum value, included |PARAMETER1=
|descr= Returns a random (float) number between the two passed numbers. The order of parameters doesn't matter: it can be {{hl|[min, max]}} or {{hl|[max, min]}}.


|p2= max: [[Number]] - maximum value, included |PARAMETER2=
|s1= [min, max] call [[BIS_fnc_randomNum]]


| [[Number]] |RETURNVALUE=
|p1= min: [[Number]] - minimum value, inclusive
____________________________________________________________________________________________


|x1= <code>[1,3] [[call]] [[BIS_fnc_randomNum]]; {{codecomment|// can be 1, 3 or any value in-between}}</code> |EXAMPLE1=
|p2= max: [[Number]] - maximum value, exclusive
____________________________________________________________________________________________


| [[BIS_fnc_randomInt]], [[BIS_fnc_arithmeticMean]], [[BIS_fnc_geometricMean]], [[BIS_fnc_nearestNum]], [[BIS_fnc_sortNum]], [[BIS_fnc_roundNum]] |SEEALSO=
|r1= [[Number]]
}}


<h3 style="display:none">Notes</h3>
|x1= <sqf>[1, 3] call BIS_fnc_randomNum; // return a number between 1 and 3, including 1</sqf>
<dl class="command_description">
<!-- Note Section BEGIN -->


<!-- Note Section END -->
|seealso= [[BIS_fnc_randomInt]] [[BIS_fnc_arithmeticMean]] [[BIS_fnc_geometricMean]] [[BIS_fnc_nearestNum]] [[BIS_fnc_sortNum]] [[BIS_fnc_roundNum]]
</dl>
}}
 
<h3 style="display:none">Bottom Section</h3>
[[Category:Functions|{{uc:randomNum}}]]
[[Category:{{Name|arma2}}: Functions|{{uc:randomNum}}]]
[[Category:{{Name|arma2oa}}: Functions|{{uc:randomNum}}]]
[[Category:{{Name|tkoh}}: Functions|{{uc:randomNum}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:randomNum}}]]

Latest revision as of 14:01, 24 February 2023

Hover & click on the images for description

Description

Description:
Returns a random (float) number between the two passed numbers. The order of parameters doesn't matter: it can be [min, max] or [max, min].
Execution:
call
Groups:
Math

Syntax

Syntax:
[min, max] call BIS_fnc_randomNum
Parameters:
min: Number - minimum value, inclusive
max: Number - maximum value, exclusive
Return Value:
Number

Examples

Example 1:
[1, 3] call BIS_fnc_randomNum; // return a number between 1 and 3, including 1

Additional Information

See also:
BIS_fnc_randomInt BIS_fnc_arithmeticMean BIS_fnc_geometricMean BIS_fnc_nearestNum BIS_fnc_sortNum BIS_fnc_roundNum

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note