-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e0eeea
commit c099d07
Showing
2 changed files
with
32 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
|
||
namespace Auth0.Core | ||
{ | ||
internal sealed class ConcurrentRandom | ||
{ | ||
private static readonly Random SRandom = new Random(); | ||
|
||
/// <summary> | ||
/// Returns a random integer that is within a specified range. | ||
/// </summary> | ||
/// <param name="minValue">The inclusive lower bound of the random number returned.</param> | ||
/// <param name="maxValue">The exclusive upper bound of the random number returned. <paramref name="maxValue" /> must be greater than or equal to <paramref name="minValue" />.</param> | ||
/// <returns>A 32-bit signed integer greater than or equal to <paramref name="minValue" /> and less than <paramref name="maxValue" />; that is, the range of return values includes <paramref name="minValue" /> but not <paramref name="maxValue" />. If <paramref name="minValue" /> equals <paramref name="maxValue" />, <paramref name="minValue" /> is returned.</returns> | ||
public int Next(int minValue, int maxValue) | ||
{ | ||
lock (SRandom) | ||
{ | ||
return SRandom.Next(minValue, maxValue); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters