Difference between revisions of "RBoolEx"
From SCAR Divi Manual
(Created page with "==Definition== <source lang="scar" lines="false"> function RBoolEx(Chance: Integer): Boolean; </source> ===Source Code=== <source lang="scar"> function RBoolEx(Chance: Integer):...") |
(No difference)
|
Latest revision as of 13:33, 4 July 2011
Definition
function RBoolEx(Chance: Integer): Boolean;
Source Code
function RBoolEx(Chance: Integer): Boolean;
begin
if Chance = 0 then
Result := True
else
Result := Random(Chance) = 0;
end;Availability
SCAR Divi 3.00 > Current
Description
Returns a random boolean value with a change of 1/Chance that the returned value is true. If Chance is 0, true is returned.
Example
var
i: Integer;
begin
for i := 1 to 5 do
WriteLn(RBoolEx(10));
end.