RBoolEx

From SCAR Divi Manual
Jump to: navigation, search

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.

See Also