@@ -25,11 +25,16 @@ public class CombinatorialRandomAttribute : Attribute
25
25
/// </summary>
26
26
public const int DefaultMaxValue = int . MaxValue ;
27
27
28
+ /// <summary>
29
+ /// Special seed value to create System.Random class without seed.
30
+ /// </summary>
31
+ public const int NoSeed = int . MinValue ;
32
+
28
33
/// <summary>
29
34
/// Initializes a new instance of the <see cref="CombinatorialRandomAttribute"/> class.
30
35
/// </summary>
31
36
public CombinatorialRandomAttribute ( )
32
- : this ( DefaultCount , DefaultMinValue , DefaultMaxValue , null )
37
+ : this ( DefaultCount , DefaultMinValue , DefaultMaxValue , NoSeed )
33
38
{
34
39
}
35
40
@@ -41,7 +46,7 @@ public CombinatorialRandomAttribute()
41
46
/// Cannot be less than 1, which would conceptually result in zero test cases.
42
47
/// </param>
43
48
public CombinatorialRandomAttribute ( int count )
44
- : this ( count , DefaultMinValue , DefaultMaxValue , null )
49
+ : this ( count , DefaultMinValue , DefaultMaxValue , NoSeed )
45
50
{
46
51
}
47
52
@@ -56,7 +61,7 @@ public CombinatorialRandomAttribute(int count)
56
61
/// maxValue for System.Random.Next method.
57
62
/// </param>
58
63
public CombinatorialRandomAttribute ( int count , int maxValue )
59
- : this ( count , DefaultMinValue , maxValue , null )
64
+ : this ( count , DefaultMinValue , maxValue , NoSeed )
60
65
{
61
66
}
62
67
@@ -74,7 +79,7 @@ public CombinatorialRandomAttribute(int count, int maxValue)
74
79
/// maxValue for System.Random.Next method.
75
80
/// </param>
76
81
public CombinatorialRandomAttribute ( int count , int minValue , int maxValue )
77
- : this ( count , minValue , maxValue , null )
82
+ : this ( count , minValue , maxValue , NoSeed )
78
83
{
79
84
}
80
85
@@ -92,16 +97,16 @@ public CombinatorialRandomAttribute(int count, int minValue, int maxValue)
92
97
/// maxValue for System.Random.Next method.
93
98
/// </param>
94
99
/// <param name="seed">
95
- /// seed for System.Random constructor.
100
+ /// Seed for System.Random constructor. If Seed equal to NoSeed value then System.Random constructor whithout seed used .
96
101
/// </param>
97
- public CombinatorialRandomAttribute ( int count , int minValue , int maxValue , int ? seed )
102
+ public CombinatorialRandomAttribute ( int count , int minValue , int maxValue , int seed )
98
103
{
99
104
if ( count < 1 )
100
105
{
101
106
throw new ArgumentOutOfRangeException ( nameof ( count ) ) ;
102
107
}
103
108
104
- var random = seed . HasValue ? new Random ( seed . Value ) : new Random ( ) ;
109
+ var random = seed == NoSeed ? new Random ( ) : new Random ( seed ) ;
105
110
106
111
object [ ] values = new object [ count ] ;
107
112
for ( int i = 0 ; i < count ; i ++ )
0 commit comments