Class FRRandom
The pseudo-random generator.
Inheritance
Namespace: FastReport.Utils
Assembly: FastReport.Base.dll
Syntax
public class FRRandom
Constructors
FRRandom()
Initializes a new instance of the FRRandom class.
Declaration
public FRRandom()
Methods
GetRandomObject(Object, Type)
Gets randomized object based on the source object.
Declaration
public object GetRandomObject(object source, Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Object | source | The source object. |
System.Type | type | The type of object. |
Returns
Type | Description |
---|---|
System.Object | Random object based on source. |
NextByte()
Gets the random byte value.
Declaration
public byte NextByte()
Returns
Type | Description |
---|---|
System.Byte | Random byte value. |
NextBytes(Int32)
Gets random byte array with specified number of elements.
Declaration
public byte[] NextBytes(int number)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | number | The number of elements in array. |
Returns
Type | Description |
---|---|
System.Byte[] | Random byte array. |
NextChar()
Gets the randomized char value.
Declaration
public char NextChar()
Returns
Type | Description |
---|---|
System.Char | Random char value. |
NextDay(DateTime)
Gets the random day from start to DataTime.Today.
Declaration
public DateTime NextDay(DateTime start)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | start | The starting DateTime value. |
Returns
Type | Description |
---|---|
System.DateTime | Random DateTime value. |
NextDigit()
Gets random int value from 0 to 9.
Declaration
public int NextDigit()
Returns
Type | Description |
---|---|
System.Int32 | Random int value. |
NextDigit(Int32)
Gets random int value from 0 to max.
Declaration
public int NextDigit(int max)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | max | The maximum for random digit. |
Returns
Type | Description |
---|---|
System.Int32 | Random int value. |
NextDigit(Int32, Int32)
Gets random int value from min to max.
Declaration
public int NextDigit(int min, int max)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | min | The minimum for random digit. |
System.Int32 | max | The maximum for random digit. |
Returns
Type | Description |
---|---|
System.Int32 | Random int value. |
NextDigits(Int32)
Gets number of random digits from 0 to 9.
Declaration
public string NextDigits(int number)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | number | The number of digits. |
Returns
Type | Description |
---|---|
System.String | Number of random digits. |
NextLetter(Char)
Gets a random letter in same case that source character.
Declaration
public char NextLetter(char source)
Parameters
Type | Name | Description |
---|---|---|
System.Char | source | The source character. |
Returns
Type | Description |
---|---|
System.Char | The random character. |
NextTimeSpanBetweenHours(Int32, Int32)
Gets the randomized TimeSpan value beetwin specified hours.
Declaration
public TimeSpan NextTimeSpanBetweenHours(int start, int end)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | start | The starting hour (0 - 24). |
System.Int32 | end | The ending hour (0 - 24). |
Returns
Type | Description |
---|---|
System.TimeSpan | Random TimeSpan value. |
RandomizeDataSources(DataSourceCollection)
Randomizes datasources.
Declaration
public void RandomizeDataSources(DataSourceCollection datasources)
Parameters
Type | Name | Description |
---|---|---|
DataSourceCollection | datasources | Collection of datasources. |
RandomizeDecimal(Decimal)
Gets the randomized decimal value with same number of digits that in source value.
Declaration
public decimal RandomizeDecimal(decimal source)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | source | The source decimal value. |
Returns
Type | Description |
---|---|
System.Decimal | Random decimal value based on source. |
RandomizeDouble(Double)
Gets the randomized double value with same number of digits that in source value.
Declaration
public double RandomizeDouble(double source)
Parameters
Type | Name | Description |
---|---|---|
System.Double | source | The source double value. |
Returns
Type | Description |
---|---|
System.Double | Random double value based on source. |
RandomizeFloat(Single)
Gets the randomized Single value with same number of digits that in source value.
Declaration
public float RandomizeFloat(float source)
Parameters
Type | Name | Description |
---|---|---|
System.Single | source | The source Single value. |
Returns
Type | Description |
---|---|
System.Single | Random Single value based on source. |
RandomizeInt16(Int16)
Gets the randomized Int16 value with same number of digits that in source value.
Declaration
public short RandomizeInt16(short source)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | source | The source Int16 value. |
Returns
Type | Description |
---|---|
System.Int16 | Random Int16 value based on source. |
RandomizeInt32(Int32)
Gets the randomized Int32 value with same number of digits that in source value.
Declaration
public int RandomizeInt32(int source)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | source | The source Int32 value. |
Returns
Type | Description |
---|---|
System.Int32 | Random Int32 value based on source. |
RandomizeInt64(Int64)
Gets the randomized Int64 value with same number of digits that in source value.
Declaration
public long RandomizeInt64(long source)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | source | The source Int64 value. |
Returns
Type | Description |
---|---|
System.Int64 | Random Int64 value based on source. |
RandomizeSByte(SByte)
Gets the randomized SByte value with same number of digits that in source value.
Declaration
public sbyte RandomizeSByte(sbyte source)
Parameters
Type | Name | Description |
---|---|---|
System.SByte | source | The source SByte value. |
Returns
Type | Description |
---|---|
System.SByte | Random SByte value based on source. |
RandomizeString(String)
Gets the randomized string with same length and same whitespaces that in source string.
Declaration
public string RandomizeString(string source)
Parameters
Type | Name | Description |
---|---|---|
System.String | source | The source string. |
Returns
Type | Description |
---|---|
System.String | Random string based on source string. |
RandomizeUInt16(UInt16)
Gets the randomized UInt16 value with same number of digits that in source value.
Declaration
public ushort RandomizeUInt16(ushort source)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | source | The source UInt16 value. |
Returns
Type | Description |
---|---|
System.UInt16 | Random UInt16 value based on source. |
RandomizeUInt32(UInt32)
Gets the randomized UInt32 value with same number of digits that in source value.
Declaration
public uint RandomizeUInt32(uint source)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | source | The source UInt32 value. |
Returns
Type | Description |
---|---|
System.UInt32 | Random UInt32 value based on source. |
RandomizeUInt64(UInt64)
Gets the randomized UInt64 value with same number of digits that in source value.
Declaration
public ulong RandomizeUInt64(ulong source)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | source | The source UInt64 value. |
Returns
Type | Description |
---|---|
System.UInt64 | Random UInt64 value based on source. |