Skip to content

Commit ffe887f

Browse files
committed
Fixed potential randomisation issue
1 parent 0333bac commit ffe887f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

NTestDataBuilder/DataSources/Generators/RandomGenerator.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace NTestDataBuilder.DataSources.Generators
77
/// </summary>
88
public class RandomGenerator : IGenerator
99
{
10-
private readonly Random _random;
10+
private static readonly Random Random = new Random();
1111
/// <inheritdoc />
1212
public int StartIndex { get; set; }
1313
/// <inheritdoc />
@@ -32,13 +32,12 @@ public RandomGenerator(int startIndex, int listSize)
3232

3333
StartIndex = startIndex;
3434
ListSize = listSize;
35-
_random = new Random();
3635
}
3736

3837
/// <inerhitdoc />
3938
public int Generate()
4039
{
41-
return _random.Next(StartIndex, ListSize);
40+
return Random.Next(StartIndex, ListSize);
4241
}
4342
}
4443
}

0 commit comments

Comments
 (0)