Random

Class in ChivalrousGames.Common

Description

Handles randomization. Works with a seed that will be incremented each time it is used.

Properties

StartingSeed string ReadOnly
Gets the starting seed

Constructors

Constructor
public Random ();
Return
Random A new instance of Random
Description

Creates a new instance of Random and with a random starting seed.

Constructor
public Random (string startingSeed);
Parameters
startingSeed string The starting seed to use for this random
Return
Random A new instance of Random
Description

Creates a new instance of Random and with a specified starting seed.

Methods

Range
public int Range(int min, int max);
Parameters
min int Inclusive minimum
max int Exclusive maximum
Return
int A random int between min and max
Description

Returns an int at random (depending on seed) between min value and max value

Range
public float Range(float min, float max);
Parameters
min float Inclusive minimum
max float Inclusive maximum
Return
float A random float between min and max
Description

Returns a float at random (depending on seed) between min value and max value

RandomString
public string RandomString(int length);
Parameters
length int Length of the string to return
Return
string A random string with a specified length
Description

Returns a random string of the specified length. Chars that can be included are: abcdefghijklmnopqrstuvwxyz0123456789

RandomHexNumber
public string RandomHexNumber(int digits);
Parameters
digits int Number of digits in the hex number to return
Return
string A random hex number
Description

Gets a randoms hex number.