Page MenuHomeFeedback Tracker

Unary random <SCALAR> can roll the input value.
New, NormalPublic

Description

It is possible for random 10 to output 10. See code below,

[] spawn {
    private _attempt = 0;
    while {true} do {
        if (_attempt % 50000 == 0) then {
            systemChat str (_attempt toFixed 0);
        };
        if (random 10 == 10) exitWith {
            systemChat str ["hit", _attempt toFixed 0];
        };
        _attempt = _attempt + 1;
    };
};

Depends how lucky you are :D
From wiki: Number from 0 (included) to x (excluded), yet it is possible.

Details

Severity
None
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
Scripting
Steps To Reproduce

Run

[] spawn {
    private _attempt = 0;
    while {true} do {
        if (_attempt % 50000 == 0) then {
            systemChat str (_attempt toFixed 0);
        };
        if (random 10 == 10) exitWith {
            systemChat str ["hit", _attempt toFixed 0];
        };
        _attempt = _attempt + 1;
    };
};

And try to be lucky.

Event Timeline

sharp1337 created this task.Oct 9 2022, 9:52 PM