Skip to content

Commit

Permalink
JPL.Math: +func. RandomBool
Browse files Browse the repository at this point in the history
  • Loading branch information
jackdp committed Oct 26, 2020
1 parent 8f498d8 commit 0eb11a6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Base/JPL.Math.pas
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function InRange(const Value, Min, Max: integer): Boolean;

function RandomInt(const Min, Max: integer; ErrorValue: integer = -1): integer;
function RandomByte(Min: Byte = 0; Max: Byte = 255; ErrorValue: Byte = 0): Byte;
function RandomBool: Boolean;


implementation
Expand All @@ -61,6 +62,11 @@ function RandomByte(Min: Byte = 0; Max: Byte = 255; ErrorValue: Byte = 0): Byte;
Result := Random((Max - Min) + 1) + Min;
end;

function RandomBool: Boolean;
begin
Result := RandomByte(0, 1) = 1;
end;


function InRange(const Value, Min, Max: integer): Boolean;
begin
Expand Down

0 comments on commit 0eb11a6

Please sign in to comment.