Pip-Services-Commons-Dotnet
Static Public Member Functions | Static Private Attributes | List of all members
PipServices3.Commons.Random.RandomBoolean Class Reference

Random generator for boolean values. More...

Static Public Member Functions

static bool Chance (float chances, float maxChances)
 Calculates "chance" out of "max chances". Example: 1 chance out of 3 chances (or 33.3%) More...
 
static bool NextBoolean ()
 Generates a random boolean value. More...
 

Static Private Attributes

static readonly System.Random _random = new System.Random()
 

Detailed Description

Random generator for boolean values.

var value1 = RandomBoolean.NextBoolean(); // Possible result: true
var value2 = RandomBoolean.Chance(1,3); // Possible result: false

Member Function Documentation

◆ Chance()

static bool PipServices3.Commons.Random.RandomBoolean.Chance ( float  chances,
float  maxChances 
)
static

Calculates "chance" out of "max chances". Example: 1 chance out of 3 chances (or 33.3%)

Parameters
chancesa chance proportional to maxChances.
maxChancesa maximum number of chances
Returns
random boolean value.

◆ NextBoolean()

static bool PipServices3.Commons.Random.RandomBoolean.NextBoolean ( )
static

Generates a random boolean value.

Returns
random boolean value.

The documentation for this class was generated from the following file: