RandomArray
Ecng.Common
Provides functionality to generate a random array of values of type T.
构造函数
RandomArray
public RandomArray(int count)
randomArray = RandomArray(count)
Initializes a new instance of the RandomArray class with a specified count.
- count
- The number of elements in the random array.
RandomArray
public RandomArray(int count, IRandomProvider provider)
randomArray = RandomArray(count, provider)
Initializes a new instance of the RandomArray class with a specified count, drawing from the given source.
- count
- The number of elements in the random array.
- provider
- Where the values come from; the shared unseeded source when null.
RandomArray
public RandomArray(T min, T max, int count)
randomArray = RandomArray(min, max, count)
Initializes a new instance of the RandomArray class within a specified range.
- min
- The minimum value of the range.
- max
- The maximum value of the range.
- count
- The number of elements in the random array.
RandomArray
public RandomArray(T min, T max, int count, IRandomProvider provider)
randomArray = RandomArray(min, max, count, provider)
Initializes a new instance of the RandomArray class within a specified range, drawing from the given source.
- min
- The minimum value of the range.
- max
- The maximum value of the range.
- count
- The number of elements in the random array.
- provider
- Where the values come from; the shared unseeded source when null.
属性
Count
public int Count { get; }
value = randomArray.Count
Gets the total number of elements in the random array.
Max
public T Max { get; }
value = randomArray.Max
Gets the maximum value used in the random array generation.
Min
public T Min { get; }
value = randomArray.Min
Gets the minimum value (or default seed value) used in the random array generation.
方法
Next
public T Next()
result = randomArray.Next()
Returns the next random element from the array.
返回值: A random element of type T from the array.